-
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
Showing
7 changed files
with
94 additions
and
26 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,28 @@ | ||
package interval_analysis.chain; | ||
|
||
import com.rapidminer.operator.Operator; | ||
import com.rapidminer.operator.OperatorDescription; | ||
import com.rapidminer.operator.OperatorException; | ||
import com.rapidminer.operator.ports.InputPort; | ||
import com.rapidminer.operator.ports.OutputPort; | ||
|
||
/** | ||
* Created by IntelliJ IDEA. | ||
* User: InquisitioN | ||
* Date: 26.03.2011 | ||
* Time: 15:58:12 | ||
* To change this template use File | Settings | File Templates. | ||
*/ | ||
public class RMBuildingCounter extends Operator { | ||
private OutputPort outValue = getOutputPorts().createPort("Items"); | ||
private InputPort inChainLeight = getInputPorts().createPort("Leight"); | ||
private InputPort inChainPower = getInputPorts().createPort("Power"); | ||
|
||
public RMBuildingCounter(OperatorDescription description) { | ||
super(description); | ||
} | ||
@Override | ||
public void doWork() throws OperatorException { | ||
RMChainSet Leight = inChainLeight.getData(RMChainSet.class); | ||
RMChainSet Power = inChainPower.getData(RMChainSet.class); | ||
} |
33 changes: 30 additions & 3 deletions
33
src/libiada/IntervalAnalysis/Buildings/BuildingCounter.java
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 |
---|---|---|
@@ -1,13 +1,40 @@ | ||
package libiada.IntervalAnalysis.Buildings; | ||
|
||
import java.util.ArrayList; | ||
|
||
/** | ||
* Created by IntelliJ IDEA. | ||
* User: Alex | ||
* Date: 20.03.11 | ||
* Time: 22:33 | ||
*/ | ||
public class BuildingCounter { | ||
public int caclculate(int chainLength, int alphabetPower) { | ||
return 0; //TODO: "To code method" | ||
public class BuildingCounter | ||
{ | ||
public int calculate(int chainLength, int alphabetPower) throws Exception { | ||
if (chainLength <= 0) | ||
throw new Exception("Chain Length is below or equal to zero"); | ||
if (alphabetPower <= 0) | ||
throw new Exception("Alphabet Power is below or equal to zero"); | ||
ArrayList<Integer> a_prev = new ArrayList<Integer>(); | ||
ArrayList<Integer> a_current = new ArrayList<Integer>(); | ||
a_prev.add(1); | ||
int F = 1; | ||
int S = 2; | ||
while (S <= chainLength) { | ||
F = 0; | ||
a_current.clear(); | ||
for (Integer item : a_prev) { | ||
for (int i = 0; i < item-1; i++) { | ||
a_current.add(item); | ||
F=F+item; | ||
} | ||
int lastItem = Math.min(item + 1, alphabetPower); | ||
a_current.add(lastItem); | ||
F = F + lastItem; | ||
} | ||
a_prev = (ArrayList<Integer>) a_current.clone(); | ||
S++; | ||
} | ||
return F; | ||
} | ||
} |
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