-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
DDred
committed
Mar 27, 2011
1 parent
ea1ba8c
commit 9147d09
Showing
4 changed files
with
100 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |