|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.swabunga.spell.event.AbstractWordFinder
Defines common methods and behaviour for the various word finding subclasses.
| Field Summary | |
protected Word |
currentWord
|
protected Word |
nextWord
|
protected java.text.BreakIterator |
sentenceIterator
|
protected boolean |
startsSentence
|
protected java.lang.String |
text
|
| Constructor Summary | |
AbstractWordFinder()
|
|
AbstractWordFinder(java.lang.String inText)
Creates a new AbstractWordFinder object. |
|
| Method Summary | |
Word |
current()
Returns the current word in the iteration . |
java.lang.String |
getText()
Return the text being searched. |
boolean |
hasNext()
Tests the finder to see if any more words are available. |
protected int |
ignore(int index,
char startIgnore)
|
protected int |
ignore(int index,
java.lang.Character startIgnore,
java.lang.Character endIgnore)
|
protected int |
ignore(int index,
char startIgnore,
char endIgnore)
|
protected int |
ignore(int index,
java.lang.String startIgnore,
java.lang.String endIgnore)
|
protected void |
init()
|
protected boolean |
isWordChar(char c)
|
protected boolean |
isWordChar(int posn)
|
abstract Word |
next()
This method scans the text from the end of the last word, and returns a new Word object corresponding to the next word. |
void |
replace(java.lang.String newWord)
Replace the current word in the search with a replacement string. |
protected void |
setSentenceIterator(Word wd)
|
void |
setText(java.lang.String newText)
This method resets the text through which the WordFinder iterates. |
boolean |
startsSentence()
|
java.lang.String |
toString()
Return the text being searched. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected Word currentWord
protected Word nextWord
protected boolean startsSentence
protected java.lang.String text
protected java.text.BreakIterator sentenceIterator
| Constructor Detail |
public AbstractWordFinder(java.lang.String inText)
inText - the String to iterate through.public AbstractWordFinder()
| Method Detail |
public abstract Word next()
next in interface WordFinderpublic java.lang.String getText()
getText in interface WordFinderpublic void setText(java.lang.String newText)
WordFinder
setText in interface WordFindernewText - the new text to search.public Word current()
current in interface WordFinderWordNotFoundException - current word has not yet been set.public boolean hasNext()
WordFinder
hasNext in interface WordFinderpublic void replace(java.lang.String newWord)
replace in interface WordFindernewWord - the replacement string.
WordNotFoundException - current word has not yet been set.public boolean startsSentence()
startsSentence in interface WordFinderWordNotFoundException - current word has not yet been set.public java.lang.String toString()
protected void setSentenceIterator(Word wd)
protected boolean isWordChar(int posn)
protected boolean isWordChar(char c)
protected int ignore(int index,
char startIgnore)
protected int ignore(int index,
char startIgnore,
char endIgnore)
protected int ignore(int index,
java.lang.Character startIgnore,
java.lang.Character endIgnore)
protected int ignore(int index,
java.lang.String startIgnore,
java.lang.String endIgnore)
protected void init()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||