|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object WordNode
public class WordNode
Objects of the WordNode class represent a node in a WordTree. User's should not interact with WordNodes directly.
Constructor Summary | |
---|---|
WordNode(char letter)
WordNode constructor. |
Method Summary | |
---|---|
void |
addLetters(java.lang.String letters)
Letters represents the end of some word. |
int |
calcLongestWord(int depth)
Pre-compute and store the longest word under this node in the tree. |
boolean |
isWord(java.lang.String string)
Recursively check to see if the indicated string contains a word. |
int |
longestWord(java.lang.String string)
Return the length of the longest word under this node with the indicated beginning. |
int |
numWords(java.lang.String string)
Return the length of the number of words under this node with the indicated beginning. |
void |
printWords(java.lang.String wordSoFar)
Recursively print every word stored under this node. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WordNode(char letter)
letter
- The letter stored in this node.Method Detail |
---|
public int calcLongestWord(int depth)
depth
- The depth of this node in the tree.
public void addLetters(java.lang.String letters)
letters
- The end of a word.public void printWords(java.lang.String wordSoFar)
wordSoFar
- All the letters on the path from the
root to this node.public int longestWord(java.lang.String string)
string
- The beginning of some word.
public int numWords(java.lang.String string)
string
- The beginning of some word or words.
public boolean isWord(java.lang.String string)
string
- The end of the current word being checked.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |