-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNode.java
More file actions
43 lines (32 loc) · 858 Bytes
/
Node.java
File metadata and controls
43 lines (32 loc) · 858 Bytes
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
/*
* A single linkable node that stores a CounterObject
*/
public class Node {
protected CounterObject value; // information
protected Node right; // points to right node
public Node () {}
public Node (CounterObject value) {
this.value = value;
}
public void changeRight (Node other) {
this.right = other;
}
public void changeValue (CounterObject newValue) {
this.value = newValue;
}
public void addOccurrence() {
this.value.addOccurrence();
}
public void setOccurrences(int occurs) {
this.value.setOccurrences(occurs);
}
public int getOccurrences() {
return this.value.getOccurrences();
}
public Node getRight() {
return this.right;
}
public CounterObject getValue() {
return this.value;
}
} //==> class Node