-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTrieNode.java
More file actions
42 lines (34 loc) · 852 Bytes
/
TrieNode.java
File metadata and controls
42 lines (34 loc) · 852 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
public class TrieNode {
private boolean isWord;
private final int SIZE = 26;// Alphabet size (# of symbols)
private char character;
private final TrieNode[] children = new TrieNode[SIZE];
private int rep = 0;
public TrieNode() {
isWord = false;
for (int i = 0; i < SIZE; i++)
children[i] = null;
}
public boolean isWord() {
return isWord;
}
public void setWord(boolean word) {
isWord = word;
}
public char getCharacter() {
return character;
}
public void setCharacter(char character) {
this.character = character;
}
public TrieNode[] getChildren() {
return children;
}
public int getRep() {
return rep;
}
public void addRep() {//for priority
if (isWord)
rep++;
}
}