Newer
Older

Peter Wagenhuber
committed
package nloc;

Peter Wagenhuber
committed

Peter Wagenhuber
committed
public class SequenceTuple {

Peter Wagenhuber
committed
private Droplet droplet;
private int minPos, maxPos;
private List<Channel> path;

Peter Wagenhuber
committed

Peter Wagenhuber
committed
public SequenceTuple(Droplet droplet, List<Channel> path) {
this.minPos = 0;
this.maxPos = 0;
this.droplet = droplet;
this.path = path;
this.currentBifuraction = null;
}
public SequenceTuple(Droplet droplet, List<Channel> path,
Channel currentBifuraction) {
this.minPos = 0;
this.maxPos = 0;
this.droplet = droplet;
this.path = path;
this.currentBifuraction = currentBifuraction;

Peter Wagenhuber
committed
}
public SequenceTuple(Droplet droplet, List<Channel> path, int minPos, int maxPos) {
this.minPos = minPos;
this.maxPos = maxPos;
this.droplet = droplet;
this.path = path;

Peter Wagenhuber
committed
}

Peter Wagenhuber
committed
}

Peter Wagenhuber
committed
}

Peter Wagenhuber
committed
}
public void setMinPos(int minPos) {
this.minPos = minPos;

Peter Wagenhuber
committed
}
public void setMaxPos(int maxPos) {
this.maxPos = maxPos;

Peter Wagenhuber
committed
}
public void setDroplet(Droplet droplet) {
this.droplet = droplet;

Peter Wagenhuber
committed
}
public void setPath(List<Channel> path) {
this.path = path;

Peter Wagenhuber
committed
}
public void setCurrentBifurcation(Channel currentBifuraction) {
this.currentBifuraction = currentBifuraction;
}
public Channel getCurrentBifurcation() {
return currentBifuraction;
}
public Channel getPreviousBifurcation() {
Channel prevBifurc = null;
List<Channel> bfList = new ArrayList<Channel>();
for (Channel ch: this.path) {
if (ch instanceof Pump) {
bfList.add(ch);
}
if (ch.isBifurcation()) {
bfList.add(ch);
}
}
if (this.currentBifuraction == null) {
prevBifurc = bfList.get(bfList.size() - 1);
} else if (!(this.currentBifuraction instanceof Pump)) {
prevBifurc = bfList.get(bfList.indexOf(this.currentBifuraction) - 1);
} else {
prevBifurc = this.currentBifuraction;
}
return prevBifurc;
}
public Channel getPumpOutlet() {
Channel outlet = null;
for (Channel ch: path) {
if (ch.getParents().size() == 1 &&
ch.getParents().get(0) instanceof Pump) {
outlet = ch;
}
}
return outlet;
}