Skip to content
Snippets Groups Projects
Commit df007cc5 authored by Peter Wagenhuber's avatar Peter Wagenhuber
Browse files

grad auf halbem weg zur generiertung der moeglichen sequenzen an einer bifurcation

parent ba9424c2
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,12 @@ public class Droplet { ...@@ -15,6 +15,12 @@ public class Droplet {
this.position.getChannel().addDroplet(this); this.position.getChannel().addDroplet(this);
} }
public Droplet(DropletType type) {
this.position = null;
this.type = type;
this.pumpOutlet = null;
}
public void move() { public void move() {
position.increment(this); position.increment(this);
} }
...@@ -101,7 +107,9 @@ public class Droplet { ...@@ -101,7 +107,9 @@ public class Droplet {
} }
public void setPosition(Position position) { public void setPosition(Position position) {
this.position.getChannel().removeDroplet(this); if (position != null) {
this.position.getChannel().removeDroplet(this);
}
this.position = position; this.position = position;
this.position.getChannel().addDroplet(this); this.position.getChannel().addDroplet(this);
} }
......
...@@ -67,23 +67,16 @@ public class Nloc { ...@@ -67,23 +67,16 @@ public class Nloc {
} }
} }
public List<BFTableEntry> initializeBifTable(List<Channel> desiredPath) { public List<Channel> getBifurcationList(List<Channel> desiredPath) {
List<BFTableEntry> bftable = new ArrayList<BFTableEntry>(); List<Channel> bfList = new ArrayList<Channel>();
ListIterator<Channel> iter = desiredPath.listIterator(); for (Channel ch: desiredPath) {
if (ch.isBifurcation) {
while(iter.hasNext()) { bfList.add(ch);
Channel current = iter.next();
if (current.isBifurcation()) {
Channel following = iter.next();
int prio = current.getChildrenList().indexOf(following) + 1;
int bfMinSteps = current.getChildrenList().get(0).getHSteps();
bftable.add(new BFTableEntry(prio, bfMinSteps));
iter.previous();
} }
} }
return bftable; return bfList;
} }
//public Pump generateDropletSequence(List<String> modules) //public Pump generateDropletSequence(List<String> modules)
...@@ -95,8 +88,8 @@ public class Nloc { ...@@ -95,8 +88,8 @@ public class Nloc {
// List<List<Channel>> pathlist = this.getAllPaths(); // List<List<Channel>> pathlist = this.getAllPaths();
// List<Channel> desiredPath = getDesiredPath(modPath, pathlist); // List<Channel> desiredPath = getDesiredPath(modPath, pathlist);
// List<BFTableEntry> bftable = calcBFTable(desiredPath); // List<SequenceTuple> bftable = calcBFTable(desiredPath);
// BFTableEntry startConfiguration = bftable.get(0); // SequenceTuple startConfiguration = bftable.get(0);
// pump = createDropletsequenceInPump(pump, startConfiguration); // pump = createDropletsequenceInPump(pump, startConfiguration);
...@@ -104,7 +97,7 @@ public class Nloc { ...@@ -104,7 +97,7 @@ public class Nloc {
//} //}
//private Pump createDropletsequenceInPump(Pump pump, //private Pump createDropletsequenceInPump(Pump pump,
// BFTableEntry startConfiguration) { // SequenceTuple startConfiguration) {
// int noOfDroplets = startConfiguration.getNoOfDroplets(); // int noOfDroplets = startConfiguration.getNoOfDroplets();
// int minTimediff = startConfiguration.getMinTimediff(); // int minTimediff = startConfiguration.getMinTimediff();
...@@ -220,20 +213,55 @@ public class Nloc { ...@@ -220,20 +213,55 @@ public class Nloc {
} }
} }
public List<List<Channel>> getSequencesAtBifurcation( public List<List<SequenceTuple>> getSequencesAtBifurcation(
List<Channel> path, Channel currentChan) { List<SequenceTuple> seqTup, SequenceTuple currentSeqTup,
Channel currentBifurcation) {
List<List<SequenceTuple>> seqTupList = new ArrayList<List<SequenceTuple>>();
List<List<Channel>> chanList = new ArrayList<List<Channel>>(); getSequencesAtBifurcationRecursive(seqTup, currentSeqTup, seqTupList,
getSequencesAtBifurcationRecursive(path, currentChan, chanList); currentBifurcation);
return chanList;
return seqTupList;
} }
private void getSequencesAtBifurcationRecursive( private void getSequencesAtBifurcationRecursive(
List<Channel> path, Channel currentChan, List<SequenceTuple> seqTupList, SequenceTuple currentSeqTup,
List<List<Channel>> possibleSequences) { List<List<SequenceTuple>> possibleSequences, Channel currentBifurcation) {
if (currentSeqTup.equals(seqTupList.get(seqTupList.size() - 1))) {
// if at last sequence tuple add another header droplet tuple if needed
// and add the list of sequence tuples to the possible sequences list
// check if header droplet is needed
List<Channel> dropletPath = currentSeqTup.getPath();
Channel bifurcSuccessor =
dropletPath.get(dropletPath.indexOf(currentBifurcation) + 1);
// bifurcation priority: prio = 0 if default channel; prio >= 1 if not
// default and threrfore header droplet needed
int prio = currentBifurcation.getChildrenList().indexOf(bifurcSuccessor);
if (dropletPath.contains(currentBifurcation) && prio > 0) {
// we need header droplet
// cirst check all possible paths of heder droplets
List<List<Channel>> pathList =
this.getAllPathsFromTo(dropletPath.get(0),
currentBifurcation.getChildrenList().get(0));
for (List<Channel> path: pathList) {
List<SequenceTuple> tmp = new ArrayList<SequenceTuple>(seqTupList);
tmp.add(new SequenceTuple(new Droplet(DropletType.HEADER),path));
// TODO: berechnen und setzen von den pump offsets
possibleSequences.add(tmp);
}
}
if (currentChan.equals(path.get(path.size() - 1))) {
} else { } else {
......
package nloc; package nloc;
public class BFTableEntry { public class SequenceTuple {
private Droplet droplet; private Droplet droplet;
private int minPos, maxPos; private int minPos, maxPos;
private List<Channel> path; private List<Channel> path;
public BFTableEntry(Droplet droplet, List<Channel> path) { public SequenceTuple(Droplet droplet, List<Channel> path) {
this.minPos = 0; this.minPos = 0;
this.maxPos = 0; this.maxPos = 0;
this.droplet = droplet; this.droplet = droplet;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment