|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.rice.cs.util.swing.FindReplaceMachine
Implementation of logic of find/replace over a document.
Field Summary | |
private Position |
_current
The position in _doc which the machine is currently at. |
private Document |
_doc
The document on which FindReplaceMachine is operating. |
private String |
_findWord
The word being sought. |
private boolean |
_found
|
private boolean |
_matchCase
|
private String |
_replaceWord
The word to replace the word being sought. |
private Position |
_start
The position in _doc from which the searches started. |
private boolean |
_wrapped
|
Constructor Summary | |
FindReplaceMachine()
NonModal version |
Method Summary | |
FindResult |
findNext()
Finds the next occurrence of the find word and returns an offset at the end of that occurrence or -1 if the word was not found. |
int |
getCurrentOffset()
Gets the character offset to which this machine is currently pointing. |
String |
getFindWord()
|
String |
getReplaceWord()
|
int |
getStartOffset()
Gets the character offset at which this machine started operations. |
boolean |
isOnMatch()
Determine if the machine is on an instance of the find word. |
void |
makeCurrentOffsetStart()
|
int |
replaceAll()
Replaces all occurences of the find word with the replace word. |
boolean |
replaceCurrent()
If we're on a match for the find word, replace it with the replace word. |
void |
setDocument(Document doc)
|
void |
setFindWord(String word)
Change the word being sought. |
void |
setMatchCase(boolean matchCase)
|
void |
setPosition(int pos)
|
void |
setReplaceWord(String word)
Change the replacing word. |
void |
setStart(int pos)
|
Methods inherited from class java.lang.Object |
|
Field Detail |
private Document _doc
private Position _start
private Position _current
private String _findWord
private String _replaceWord
private boolean _found
private boolean _wrapped
private boolean _matchCase
Constructor Detail |
public FindReplaceMachine()
Method Detail |
public void setMatchCase(boolean matchCase)
public void setDocument(Document doc)
public void setPosition(int pos)
public void setStart(int pos)
public int getStartOffset()
public int getCurrentOffset()
public void makeCurrentOffsetStart()
public String getFindWord()
public String getReplaceWord()
public void setFindWord(String word)
word
- the new word to seekpublic void setReplaceWord(String word)
word
- the new replacing wordpublic boolean isOnMatch()
public FindResult findNext()
public boolean replaceCurrent()
public int replaceAll()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |