-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHNode.java
More file actions
57 lines (41 loc) · 974 Bytes
/
HNode.java
File metadata and controls
57 lines (41 loc) · 974 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package alda.huffman;
import java.util.Comparator;
public class HNode {
private int value;
private char character;
private HNode left;
private HNode right;
public HNode(int value, char character) {
this.value = value;
this.character = character;
}
public HNode(int value) {
this.value = value;
}
public int getValue() {
return value;
}
public char getCharacter() {
return character;
}
public HNode getLeft() {
return left;
}
public void setLeft(HNode left) {
this.left = left;
}
public HNode getRight() {
return right;
}
public void setRight(HNode right) {
this.right = right;
}
public String toString() {
return value + " " + character;
}
}
class NodeComparator implements Comparator<HNode> {
public int compare(HNode q, HNode w) {
return q.getValue() - w.getValue();
}
}