Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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;
}
}
}