|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Interface for the implementation of the Trie data structure.
| Method Summary | |
void |
addToTrie(java.lang.String s)
Adds the word s to the trie. |
void |
fromFile(java.lang.String name)
Builds a trie representing the list of strings read from a file line by line. |
boolean |
isInTrie(java.lang.String s)
Returns true if the trie contains s. |
boolean |
isLeaf()
Returns true if the node p is a leaf of the trie.
|
Pair |
longestPrefixInTrie(java.lang.String s,
int j)
Computes the pair composed of the length of the longest prefix of s[j..n-1] in the trie and the vertex reached by this prefix. |
void |
removeFromTrie(java.lang.String s)
removes the string s from the trie. |
| Method Detail |
public Pair longestPrefixInTrie(java.lang.String s,
int j)
LongestPrefixInTrie() of Section 1.3.1.
s - the input stringj - the starting index
public boolean isInTrie(java.lang.String s)
s. Implements
the function IsInTrie() of Section 1.3.1.
public void addToTrie(java.lang.String s)
AddToTrie() of Section 1.3.1.
s - the string to be added.public boolean isLeaf()
p is a leaf of the trie.
Implements
the function IsLeaf() of Section 1.3.1.
public void removeFromTrie(java.lang.String s)
RemoveFromTrie() of Section 1.3.1.
s - the string to be removed
public void fromFile(java.lang.String name)
throws java.io.IOException
name - the name of the file
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||