|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectutils.TreeNode
public class TreeNode
The TreeNode-class is made to simplify storing and searching for words that should be filtered away. Each instance of TreeNode contains its own methods for recursively storing and recursively checking if a word matches the description of a word that should be removed. Each node contains only one letter, but it also contains links to a number of new nodes. If one of those nodes contains the string "end" instead of a letter, it means that if a word that is being checked ends with the letter at the present node, then it is a word that should be removed. Each node has links to other nodes and those nodes will contain other valid letters to follow the allready established trail of letters. If the word that is being checked has a letter following the current node that doesn't exist, then the word is not to be removed, it is not an unwanted word.
Field Summary | |
---|---|
private java.lang.String |
data
|
private java.util.Vector<TreeNode> |
nodes
|
private static java.lang.String |
nodeSettings
|
private static java.util.Vector<java.lang.String> |
wordEnds
|
Constructor Summary | |
---|---|
TreeNode(java.lang.String data)
The constructor stores the first letter of the String received and sends the rest of the word to be stored in following nodes. |
Method Summary | |
---|---|
java.lang.String |
getData()
A standard getter method |
void |
insert(java.lang.String wordPart)
This method is called for inserting a new word into this tree. |
boolean |
isStopWord(java.lang.String wordPart)
This method recursively checks whether an input word is a word to be removed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String nodeSettings
private static java.util.Vector<java.lang.String> wordEnds
private java.util.Vector<TreeNode> nodes
private java.lang.String data
Constructor Detail |
---|
public TreeNode(java.lang.String data)
data
- - the received word or part-of-wordMethod Detail |
---|
public void insert(java.lang.String wordPart)
wordPart
- - the received word or part-of-wordpublic boolean isStopWord(java.lang.String wordPart)
wordPart
- - the received word or part-of-word
public java.lang.String getData()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |