|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An interface for objects which take a String as input, and iterates through the words in the string.
When the object is instantiated, and before the first call to next()
is made,
the following methods should throw a WordNotFoundException
:
current()
,
startsSentence()
and replace()
.
A call to next()
when hasMoreWords()
returns false
should throw a WordNotFoundException
.
Method Summary | |
Word |
current()
This method should return the Word object representing the current word in the iteration. |
java.lang.String |
getText()
This method returns the text through which the WordFinder is iterating. |
boolean |
hasNext()
Tests the finder to see if any more words are available. |
Word |
next()
This method should return the Word object representing the next word in the iteration (the first word if next() has not yet been called.) |
void |
replace(java.lang.String newWord)
This method should replace the current Word object with a Word object representing the String newWord. |
void |
setText(java.lang.String newText)
This method resets the text through which the WordFinder iterates. |
boolean |
startsSentence()
|
Method Detail |
public java.lang.String getText()
public void setText(java.lang.String newText)
newText
- the new text to search.public Word current()
WordNotFoundException
- current word has not yet been set.public boolean hasNext()
public Word next()
WordNotFoundException
- search string contains no more words.public void replace(java.lang.String newWord)
newWord
- the word to replace the current word with.
WordNotFoundException
- current word has not yet been set.public boolean startsSentence()
WordNotFoundException
- current word has not yet been set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |