-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNode.java
More file actions
63 lines (48 loc) · 959 Bytes
/
Node.java
File metadata and controls
63 lines (48 loc) · 959 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
58
59
60
61
62
63
/* TCSS 342 - Compressed Literature
* Node class
*/
/**
* The Node used by SimpleTrees.
*
* @author Rylie Nelson
* @version Autumn 2013
*/
public class Node implements Comparable {
/**
* The character in this Node.
*/
public String word;
/**
* The frequency of the character.
*/
public Integer frequency;
/**
* This node's left child.
*/
public Node left_child;
/**
* This node's right child.
*/
public Node right_child;
/**
* Constructs a new Node.
*
* @param the_character The character of this node.
* @param the_frequency The frequency of the character.
*/
public Node(String the_word, Integer the_frequency) {
word = the_word;
frequency = the_frequency;
left_child = null;
right_child = null;
}
@Override
public int compareTo(Object o) {
Node n = (Node) o;
return frequency - n.frequency;
}
@Override
public String toString() {
return "\"" + word + "\"";
}
}