package nloc; import java.util.ArrayList; import java.util.List; public class Channel extends NlocEntity implements Comparable<Channel> { private int pSteps, hSteps; private List<Channel> parents, children; // private List<Droplet> dropletList; public Channel(int pSteps, int hSteps) { super(); this.pSteps = pSteps; this.hSteps = hSteps; this.parents = new ArrayList<Channel>(); this.children = new ArrayList<Channel>(); } public int getPSteps() { return pSteps; } public int getHSteps() { return hSteps; } public void addChild(Channel child) { if (!children.contains(child)) { children.add(child); child.addParent(this); } } public void addParent(Channel parent) { if (!parents.contains(parent)) { parents.add(parent); parent.addChild(this); } } public List<Channel> getChildren() { return children; } public List<Channel> getParents() { return parents; } public int compareTo(Channel other) { if (this.getPSteps() < other.getPSteps()) { return -1; } else if (this.getPSteps() == other.getPSteps()) { return 0; } else { return 1; } } }