T9
T9 Trie Word Completion Algorithm
|
00001 00009 package t9.trie; 00010 00011 import java.util.Comparator; 00012 00013 00022 public class TrieNode { 00023 private final char mLetter; 00024 private boolean eow; // end of word 00025 private TrieNode mChild; 00026 private TrieNode mSib; 00027 private int mFrequency; 00028 00029 public TrieNode getChild() { 00030 return mChild; 00031 } 00032 00033 public void setChild(TrieNode child) { 00034 this.mChild = child; 00035 } 00036 00037 public TrieNode getSib() { 00038 return mSib; 00039 } 00040 00041 public void setSib(TrieNode sib) { 00042 this.mSib = sib; 00043 } 00044 00045 public char getLetter() { 00046 return mLetter; 00047 } 00048 00049 public int getFrequency() { 00050 return mFrequency; 00051 } 00052 00053 public void setFrequency(int frequency) { 00054 this.mFrequency = frequency; 00055 } 00056 00057 public TrieNode(final char letter) { 00058 this.mLetter = letter; 00059 this.mChild = null; 00060 this.mSib = null; 00061 eow = false; 00062 mFrequency = -1; 00063 } 00064 00065 public void setEOW() { 00066 eow = true; 00067 } 00068 00069 public boolean isEOW() { 00070 return eow; 00071 } 00072 00073 }