|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object TrieLexicon
public class TrieLexicon
Nested Class Summary | |
---|---|
static class |
TrieLexicon.Node
|
Field Summary | |
---|---|
protected TrieLexicon.Node |
myRoot
|
protected int |
mySize
|
Constructor Summary | |
---|---|
TrieLexicon()
|
Method Summary | |
---|---|
boolean |
add(java.lang.String s)
|
protected int |
doCount(TrieLexicon.Node root)
|
protected void |
fillUp(TrieLexicon.Node root,
java.util.ArrayList<java.lang.String> list,
java.lang.StringBuilder str)
|
java.util.Iterator<java.lang.String> |
iterator()
Return an iterator over all words stored in the lexicon. |
void |
load(java.util.ArrayList<java.lang.String> list)
Clear a lexicon and store all values read from the list for subsequent querying. |
void |
load(java.util.Scanner s)
Clear a lexicon and store all values read from the scanner for subsequent querying. |
int |
nodeCount()
|
protected int |
oneWay(TrieLexicon.Node root)
|
int |
oneWayCount()
|
int |
size()
Returns number of words stored in the lexicon (as from last call to load, for example). |
LexStatus |
wordStatus(java.lang.String s)
Similar to wordStatus that takes a
StringBuilder parameter, but works with a String. |
LexStatus |
wordStatus(java.lang.StringBuilder s)
Returns value specifying whether is is in the lexicon: WORD, is the prefix of a word in the lexicon: PREFIX, or is not a prefix and not a word: NOT_WORD. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected TrieLexicon.Node myRoot
protected int mySize
Constructor Detail |
---|
public TrieLexicon()
Method Detail |
---|
public int size()
ILexicon
size
in interface ILexicon
public void load(java.util.ArrayList<java.lang.String> list)
ILexicon
load
in interface ILexicon
list
- is the source of words for the lexiconpublic boolean add(java.lang.String s)
public java.util.Iterator<java.lang.String> iterator()
ILexicon
iterator
in interface ILexicon
iterator
in interface java.lang.Iterable<java.lang.String>
protected void fillUp(TrieLexicon.Node root, java.util.ArrayList<java.lang.String> list, java.lang.StringBuilder str)
public void load(java.util.Scanner s)
ILexicon
load
in interface ILexicon
s
- is the source of words for the lexiconpublic LexStatus wordStatus(java.lang.StringBuilder s)
ILexicon
wordStatus
in interface ILexicon
s
- represents the word/sequence queried
public LexStatus wordStatus(java.lang.String s)
ILexicon
wordStatus
that takes a
StringBuilder parameter, but works with a String.
wordStatus
in interface ILexicon
s
- is the string queried
public int oneWayCount()
protected int oneWay(TrieLexicon.Node root)
public int nodeCount()
protected int doCount(TrieLexicon.Node root)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |