Newer
Older
package nloc;
public class Droplet {
private Position position;
private DropletType type;
public Droplet(DropletType type, Position position) {
this.position = position;
this.type = type;
this.position.getChannel().addDroplet(this);
}
public void move() {
position.increment(this);
}
public DropletType getType() {
return type;
}
public Position getPosition() {
return position;
}
public boolean coalesce() {
return false;
}
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;
}