-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNode.java
More file actions
39 lines (36 loc) · 885 Bytes
/
Node.java
File metadata and controls
39 lines (36 loc) · 885 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
import java.io.Serializable;
import java.util.Comparator;
import java.util.HashMap;
public class Node {
public Character value;
public HashMap<Character, Node> pointers;
public long wF;
public String word;
public Node(Character value, long num, String word)
{
this.word = word;
this.value = value;
wF = num;
pointers = new HashMap<Character, Node>();
}
public void changeWF(int newFreq)
{
wF = newFreq;
}
public void addPointer(Node newPointer)
{
pointers.put(newPointer.value, newPointer);
}
public boolean contains(char x)
{
return pointers.containsKey(x);
}
public Node get(char x)
{
return pointers.get(x);
}
public void set(char key, Node value)
{
pointers.put(key, value);
}
}