public class TrieTree
extends java.lang.Object
History:
Constructor and Description |
---|
TrieTree()
Create an object of trie tree (default).
|
TrieTree(boolean wildCard)
Create an object of trie tree, using a boolean flag of wild card.
|
Modifier and Type | Method and Description |
---|---|
java.util.Vector<TrieNode> |
FindRule(java.lang.String inStr)
Find a collection of TrieNodes which matches the suffix as a specified
term.
|
TrieNode |
GetRoot()
Get the root trie node of the current tire tree.
|
void |
LoadRulesFromFile(java.lang.String inFile,
boolean reverse,
boolean duplicateFlag)
Read in LVG trie rules from a specified rule.
|
void |
LoadRulesFromFile(java.lang.String dir,
java.lang.String fName,
boolean reverse,
boolean duplicateFlag)
Read in LVG trie rules from a specified rule.
|
static void |
main(java.lang.String[] args)
A test driver for this class.
|
void |
PrintTrie(boolean details,
boolean rulesFlag,
boolean exceptionFlag)
Print the detail informatin of current trie tree.
|
void |
SetWildCard(boolean wildCard)
Set the boolean flag of the wild card for a trie tree.
|
public TrieTree()
public TrieTree(boolean wildCard)
wildCard
- a boolean flag and is set true for using wildcardpublic void SetWildCard(boolean wildCard)
wildCard
- a boolean flag and is set true for using wildcardpublic void LoadRulesFromFile(java.lang.String dir, java.lang.String fName, boolean reverse, boolean duplicateFlag)
dir
- the path name of the directory of the LVG trie rule filefName
- the file name of the LVG trie rule filereverse
- true or false to load the rule in forward or backwardduplicateFlag
- flag to send warning message when duplicate rule
direction from the file. All rules in LVG trie are bi-directional.public void LoadRulesFromFile(java.lang.String inFile, boolean reverse, boolean duplicateFlag)
inFile
- the full path of the LVG trie rule filereverse
- true or false to load the rule in forward or backwardduplicateFlag
- flag to send warning message when duplicate rule
direction from the file. All rules in LVG trie are bi-directional.public java.util.Vector<TrieNode> FindRule(java.lang.String inStr)
inStr
- a string is used to find nodes with matching suffixpublic void PrintTrie(boolean details, boolean rulesFlag, boolean exceptionFlag)
details
- true or false to print out details (traverse path)
or not of the current trie treerulesFlag
- true or false to print out all rules of the
current trie treeexceptionFlag
- true or false to print out all exceptions of
the current trie treepublic TrieNode GetRoot()
public static void main(java.lang.String[] args)
args
- arguments