Commit 672ca9c5 authored by Peter Wagenhuber's avatar Peter Wagenhuber
Browse files

mit dem uebertragen der moeglichen sequenzen auf den pump channel begonnen

parent a8422a02
......@@ -4,6 +4,7 @@ import java.util.List;
import java.util.ArrayList;
import java.util.ListIterator;
import java.util.Arrays;
import java.lang.Math;
public class Nloc {
......@@ -95,10 +96,32 @@ public class Nloc {
// }
public Pump getShortestSequence(String[] modulesToVisit) {
List<List<SequenceTuple>> possibleSequences =
getPossibleSequences(modulesToVisit);
Pump pump = this.getPump();
try {
List<List<SequenceTuple>> possibleSequences =
getPossibleSequences(modulesToVisit);
// sort the list of possible sequences according to the sequences length
possibleSequences.sort((a,b) -> a.size() - b.size());
List<SequenceTuple> shortSeq = possibleSequences.get(0);
int min = 0, max = 0;
for (SequenceTuple stl: shortSeq) {
int tmp = stl.getMinPos();
if (tmp > max) max = tmp;
if (tmp < min) min = tmp;
}
int span = max - min;
pump.setSteps(span);
Droplet[] pumpArray = new Droplet[span];
} catch(NoSuchModuleException nsme) {
System.out.println(nsme.getMessage());
}
return pump;
}
public List<List<SequenceTuple>> getPossibleSequences(
String[] modulesToVisit) throws NoSuchModuleException {
......
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