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

beim bewegen von droplets diese auch in die richtigen channel setzen

parent 4121dc7f
No related branches found
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -39,6 +39,18 @@ public class Channel extends NlocEntity implements Comparable<Channel> {
return minDist;
}
public void removeDroplet(Droplet droplet) {
dropletList.remove(droplet);
}
public void addDroplet(Droplet droplet) {
dropletList.add(droplet);
}
public void setDropletList(List<Droplet> dropletList) {
this.dropletList = dropletList;
}
protected void setHSteps(int hSteps) {
this.hSteps = hSteps;
}
......
......@@ -20,4 +20,14 @@ public class Droplet {
public Position getPosition() {
return position;
}
public void setPosition(Position position) {
this.position.getChannel().removeDroplet(this);
this.position = position;
this.position.getChannel().addDroplet(this);
}
public boolean isInSink() {
return this.position.getChannel() instanceof Sink;
}
}
......@@ -11,7 +11,7 @@ public class Nloc {
public static void main(String[] args) {
List<Channel> chanlist = getNloc3();
List<Channel> chanlist = getNloc0();
Channel p0 = chanlist.get(chanlist.size() - 2);
List<Channel> mod = getModulesByName(Arrays.asList("m1","m2"), chanlist);
......@@ -29,6 +29,10 @@ public class Nloc {
}
System.out.println("Number of Droplets needed: " + getNumberOfDroplets(desiredPath));
}
......
......@@ -22,14 +22,6 @@ public class Position {
return chan;
}
public void setSteps(int step) {
this.step = step;
}
public void setChannel(Channel chan) {
this.chan = chan;
}
public void increment(Droplet droplet) {
int chansteps = 0;
if (droplet.getType() == DropletType.PAYLOAD) {
......@@ -46,9 +38,14 @@ public class Position {
List<Channel> possibleChannels = chan.getChildrenList();
if (!possibleChannels.isEmpty() && possibleChannels.size() == 1) {
this.chan.removeDroplet(droplet);
this.chan = possibleChannels.get(0);
this.chan.addDroplet(droplet);
} else {
Channel temp = this.chan;
this.chan = getFollowingChannel(possibleChannels);
temp.removeDroplet(droplet);
this.chan.addDroplet(droplet);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment