Commit 6c5b8416 authored by Peter Wagenhuber's avatar Peter Wagenhuber
Browse files

sequenzgenerierung aus den moeglichen dropletzequenzen nun getestet und passt

parent c4e95b45
......@@ -144,6 +144,7 @@ public class Nloc {
possibleSequences = setTuplePumpoffsetToPumpPosition(possibleSequences,
min);
currentSeq = possibleSequences.get(0);
List<Droplet> dropletSequence = generateDropletListRecursive(new ArrayList<Droplet>(), currentSeq, currentSeq.get(0).getMinPos());
......@@ -170,7 +171,7 @@ public class Nloc {
return possibleSequences;
}
private List<Droplet> generateDropletListRecursive(
public List<Droplet> generateDropletListRecursive(
List<Droplet> dropletList, List<SequenceTuple> currentSequence,
int currentPos) {
......@@ -210,13 +211,13 @@ public class Nloc {
boolean found = false;
while (!found && revIter.hasPrevious()) {
Droplet tmpDr = revIter.previous();
revIter.remove();
SequenceTuple tmpTup1 = currentSequence.get(dropletList.size() - 1);
if (tmpDr.getPosition().getSteps() == currentPos &&
currentPos < tmpTup1.getMaxPos()) {
found = true;
}
revIter.remove();
}
if (found) {
currentPos++;
......
......@@ -14,7 +14,7 @@ public class TestNloc {
//Nloc nlSX = new Nloc(getNlocS2());
//Nloc nlSX = new Nloc(getNlocS6());
//Nloc nlSX = new Nloc(getNlocS7());
Nloc nlSX = new Nloc(getNlocS8());
//Nloc nlSX = new Nloc(getNlocS8());
//try {
// List<Channel> chlist = nlSX.getModulesByName(Arrays.asList("ch1","ch3"));
......@@ -25,13 +25,49 @@ public class TestNloc {
//}
String[] mtv = {"m4","d1","m1","m3","h0","m5"};
try {
List<List<SequenceTuple>> sequences = nlSX.getPossibleSequences(mtv);
printSequences(sequences);
} catch(Exception e) {
System.out.println( e.getMessage());
}
//String[] mtv = {"m4","d1","m1","m3","h0","m5"};
//try {
// List<List<SequenceTuple>> sequences = nlSX.getPossibleSequences(mtv);
// printSequences(sequences);
//} catch(Exception e) {
// System.out.println( e.getMessage());
//}
//
//Droplet p = new Droplet(DropletType.PAYLOAD,"p");
//Droplet h1 = new Droplet(DropletType.HEADER,"h1");
//Droplet h2 = new Droplet(DropletType.HEADER,"h2");
//Droplet h3 = new Droplet(DropletType.HEADER,"h3");
//Droplet h4 = new Droplet(DropletType.HEADER,"h4");
//Pump pump = new Pump();
//Channel outlet = new Channel("ch1",1,1);
//Sink sink = new Sink();
//List<Channel> path = Arrays.asList(pump, outlet, sink);
//Nloc nloc = new Nloc(path);
//SequenceTuple st0 = new SequenceTuple(p,path,0,0);
//SequenceTuple st1 = new SequenceTuple(h1,path,1,2);
//SequenceTuple st2 = new SequenceTuple(h2,path,1,1);
//SequenceTuple st3 = new SequenceTuple(h3,path,2,2);
//
//List<SequenceTuple> stl = new ArrayList<SequenceTuple>();
//stl.add(st0);
//stl.add(st1);
//stl.add(st2);
//stl.add(st3);
//List<List<SequenceTuple>> stll = new ArrayList<List<SequenceTuple>>();
//stll.add(stl);
//
//List<Droplet> dropletList = nloc.generateDropletListRecursive(new ArrayList<Droplet>(), stl, 1);
//for (Droplet dr: dropletList) {
// System.out.println("dr: " + dr.getName() + " Pos: " + dr.getPosition().getSteps() );
//}
}
public static void printSequence(List<SequenceTuple> seq) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment