Commit cb313b3f authored by Peter Wagenhuber's avatar Peter Wagenhuber
Browse files

mit der eigentlichen testimplementierung begonnen

parent 493114ae
......@@ -17,110 +17,6 @@ public class Nloc {
this.dropletList = new ArrayList<Droplet>();
}
// public List<List<SequenceTuple>> sanitizeSequences(
// List<List<SequenceTuple>> possibleSequences) {
//
// List<List<SequenceTuple>> tmpSeqs =
// new ArrayList<List<SequenceTuple>>();
//
// for(List<SequenceTuple> seqTupList: possibleSequences) {
//
// List<SequenceTuple> tmpStl = new ArrayList<SequenceTuple>(seqTupList);
//
// for (SequenceTuple seqTup: seqTupList) {
//
// if (seqTup.getDroplet().getType() != DropletType.PAYLOAD) {
//
// List<Channel> hPath = seqTup.getPath();
//
// // generate sublist for comaparison containing the rest of the
// // sequence tuples
// List<SequenceTuple> compList =
// seqTupList.sublist(seqTupList.indexOf(seqTup),
// seqTupList.size() - 1);
//
// for (SequenceTuple compTuple: compList) {
// List<Channel> cPath = compTuple.getPath();
//
// if (seqTup.overlaps(compTuple)) {
// // check if path is the same
// // if so then merge the droplets to one
// // if not adjust the min and max position
// // if the adjustment is not possible remove the sequence
// if (hPath.equals(cPath)) {
// SequenceTuple newTup = SequenceTuple.merge(seqTup,compTuple);
// tmpStl.remove(seqTup);
// tmpStl.remove(compTuple);
// tmpStl.add(newTup);
// } // end paths are equal
// else {
// int hMin = seqTup.getMinPos();
// int hMax = seqTup.getMaxPos();
// int cMin = compTuple.getMaxPos();
// int cMax = compTuple.getMaxPos();
// if (hMin == hMax && cMin == cMax) {
// tmpStl.clear();
// } else if ((hMax - hMin) < (cMax - cMin)) {
// if (hMax < cMax) {
// compTuple.setMinPos(hMax + 1);
// } else {
// compTuple.setMaxPos(hMin - 1);
// }
// } else if ((hMax - hMin) > (cMax - cMin)) {
// if (cMax < hMax) {
// seqTup.setMinPos(cMax + 1);
// } else {
// seqTup.setMaxPos(cMin - 1);
// }
// } else if ((hMax - hMin) > (cMax - cMin)) {
// if (hMin == cMin) {
//
// } else if (hMin < cMin) {
// seqTup.setMaxPos(cMin - 1);
// } else {
// compTuple.setMaxPos(hMin - 1);
// }
// }
//
// } // end paths are not equal
//
// } // typles overlap
// } // end iter restlist
// } // payload droplet
// } // end iter sequence
// if (!tmpStl.isEmpty()) {
// tmpSeqs.add(tmpStl);
// }
// } // end iter possibleSequences
// return tmpSeqs;
// }
//ListIterator<SequenceTuple> seqIter = currentSeq.ListIterator();
//while (seqIter.hasNext()) {
// SequenceTuple currentSeqTuple = seqIter.next();
// int minPos = currentSeqTuple.getMinPos();
// int maxPos = currentSeqTuple.getMaxPos();
// Position initialDropletPosition = new Position(pump, minPos);
// Droplet currentDroplet = currentSeqTuple.getDroplet();
//
// if (position.alreadyOccupied(dropletSequence)) {
// // if occupied first try to increase position until max is reached
// // if max is also occupied then step back one droplet in list
// // and increase its position
// // if all fails return null pump indicating that no sequence could
// // be found
// for (int i = minPos; i <= maxPos; i++) {
// }
// } else {
// currentDroplet.setPosition(initialDropletPosition);
// dropletSequence.add(currentDroplet);
// }
//}
public Pump getShortestSequence(String[] modulesToVisit) {
Pump pump = this.getPump();
......
......@@ -10,6 +10,8 @@ public class TestNloc {
public static void main(String[] args) {
Nloc nl = new Nloc(getNlocS1());
List<List<Channel>> allPaths = nl.getAllPaths();
//Nloc nlSX = new Nloc(getNlocS1());
//Nloc nlSX = new Nloc(getNlocS2());
//Nloc nlSX = new Nloc(getNlocS6());
......@@ -70,6 +72,16 @@ public class TestNloc {
//}
}
public static String[] extractModuleStringArrayFromPath(List<Channel> path) {
List<String> strlist = new ArrayList<String>();
for (Channel ch: path) {
if (ch instanceof Module) {
strlist.add(ch.getName());
}
}
return strlist.toArray();
}
public static void printSequence(List<SequenceTuple> seq) {
for (SequenceTuple stup: seq) {
if (seq.indexOf(stup) == (seq.size() - 1)) {
......
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