Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
DDred committed Mar 27, 2011
1 parent ea1ba8c commit 9147d09
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package interval_analysis.chain;
package interval_analysis;

import com.rapidminer.example.*;
import com.rapidminer.operator.*;
Expand All @@ -21,7 +21,7 @@ public class SamplingDistributionRM extends Operator {
private OutputPort outPort = getOutputPorts().createPort("sample");
private InputPort inPort = getInputPorts().createPort("distribution");

public static final String PARAMETER_INTERVALS_COUNT = "intervals count";
public static final String PARAMETER_INTERVALS_COUNT = "Intervals count";

public SamplingDistributionRM(OperatorDescription description) {
super(description);
Expand Down
39 changes: 39 additions & 0 deletions src/interval_analysis/chain/MixedConverterRM.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package interval_analysis.chain;

import com.rapidminer.operator.Operator;
import com.rapidminer.operator.OperatorDescription;
import com.rapidminer.operator.UserError;
import com.rapidminer.operator.ports.InputPort;
import com.rapidminer.operator.ports.OutputPort;
import libiada.IntervalAnalysis.MixedChain;

/**
* Created by IntelliJ IDEA.
* User: Alex
* Date: 26.03.11
* Time: 22:27
*/
public class MixedConverterRM extends Operator {
public InputPort inChains = getInputPorts().createPort("chain", RMChainSet.class);
public OutputPort outChain = getOutputPorts().createPort("mixed");

public MixedConverterRM(OperatorDescription description) {
super(description);
}

@Override
public void doWork() throws UserError {
RMChainSet inputChainsSet = inChains.getData(RMChainSet.class);
RMChainSet outChainsSet = new RMChainSet();

for (int i = 0; i < inputChainsSet.getCount(); i++) {
try {
MixedChain chain = new MixedChain(inputChainsSet.get(i).toString());
outChainsSet.add(chain);
} catch (Exception e) {
System.err.print("Error of creating mixed chain");
}
}
outChain.deliver(outChainsSet);
}
}
26 changes: 26 additions & 0 deletions src/libiada/IntervalAnalysis/MixedChain.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package libiada.IntervalAnalysis;

/**
* Created by IntelliJ IDEA.
* User: Alex
* Date: 26.03.11
* Time: 19:32
*/
public class MixedChain extends Chain {
public MixedChain(int length) throws Exception {
super(length);
}

public MixedChain(String s) throws Exception {
super(s);
convert();
}

private void convert() throws Exception {
ToMixedChainConverter converter = new ToMixedChainConverter();
MixedChain newChain = converter.convert(this);

this.ClearAndSetNewLength(this.getLength());
this.fillFromAnother(newChain);
}
}
33 changes: 33 additions & 0 deletions src/libiada/IntervalAnalysis/ToMixedChainConverter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package libiada.IntervalAnalysis;

import libiada.EventTheory.PsevdoValue;
import libiada.Root.IBaseObject;
import libiada.Root.SimpleTypes.ValueInt;

import java.util.ArrayList;

/**
* Created by IntelliJ IDEA.
* User: Alex
* Date: 26.03.11
* Time: 19:40
*/
public class ToMixedChainConverter {
public MixedChain convert(Chain chain) throws Exception {
MixedChain mixedChain = new MixedChain(chain.getLength());
for (int uChainIndex = 0; uChainIndex < chain.getAlpahbet().getPower(); uChainIndex++) { //По всем однородным цепям
UniformChain uChain = chain.getIUniformChain(uChainIndex);
int currentEventNum = 0;
for (int currentUPos = 0; currentUPos < uChain.getLength(); currentUPos++) { //По всем событиям однородной цепи
if (uChain.get(currentUPos).getClass() != PsevdoValue.class) {
currentEventNum++;
} else {
continue;
}
ValueInt message = new ValueInt(currentEventNum);
mixedChain.add(message, currentUPos);
}
}
return mixedChain;
}
}

0 comments on commit 9147d09

Please sign in to comment.