|
Jive Forums API (5.5.20.2-oracle) Developer Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jivesoftware.util.SpellSession
public final class SpellSession
A spelling session is used to iteratively fix all spelling mistakes. The
next()
method performs an iteration, and then the other methods of the class
can be called to correct any errors that are found. Iterations should be
performed until the OK
result is returned.
New SpellSession objects should be created with the
SpellChecker.createSession(String)
method. This class is Serializable so
that it can be put into an HTTPSession. Note that some app-servers require you to
re-add the value to the session every time changes to the object are made.
SpellChecker
,
Serialized FormField Summary | |
---|---|
static int |
DOUBLED_WORD
The current word was repeated (doubled). |
static int |
MISSPELLED_WORD
The current word appears to be misspelled. |
static int |
OK
There were no errors; ie spell checking is done. |
Constructor Summary | |
---|---|
protected |
SpellSession(com.wintertree.ssce.SpellingSession session,
com.wintertree.ssce.WordParser wordParser,
MemLexicon memLexicon,
java.lang.String language)
|
Method Summary | |
---|---|
void |
delete()
Deletes the word returned by getWord(). |
java.lang.String |
getHighlightedText()
Returns the text being spell checked in its current state, but with all remaining spelling errors highlighted. |
java.lang.String[] |
getSuggestions()
Returns an array of alternate spelling suggestions for the misspelled word at the current cursor. |
java.lang.String[] |
getSuggestions(java.lang.String word)
Returns an array of alternate spelling suggestions for the provided word word or null if the word is not misspelt. |
java.lang.String |
getText()
Returns the text being spell checked in its current state. |
java.lang.String |
getWord()
Returns the word at the current cursor. |
void |
ignore()
Ignores the spelling mistake found for the word at the current cursor. |
void |
ignoreAll()
Ignores the spelling mistake found for the word at the current cursor and all future occurrences of the mistake. |
protected void |
ignoreAll(java.util.List ignoreWords)
Ignores the spelling mistake found for the given word and all future occurrences of the mistake. |
int |
next()
Runs the next iteration of spell checking and returns the result. |
void |
replace(java.lang.String newWord)
Replaces the word returned by getWord() with a new word. |
void |
replaceAll(java.lang.String newWord)
Replaces all occurences of the word returned by getWord() in the text with a new word. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DOUBLED_WORD
public static final int MISSPELLED_WORD
public static final int OK
Constructor Detail |
---|
protected SpellSession(com.wintertree.ssce.SpellingSession session, com.wintertree.ssce.WordParser wordParser, MemLexicon memLexicon, java.lang.String language)
Method Detail |
---|
public java.lang.String getText()
public java.lang.String getHighlightedText()
public int next()
int result; while ((result = session.next()) != SpellSession.OK) { // Decide on action to take. For example, we might want to // delete a doubled word or ignore all further occurences of a // misspelled word. }Of course, if using the SpellSession in a server-side Java application, a while loop won't be applicable.
public java.lang.String getWord()
Warning: after the next() method return a result code of SpellSession.OK, the cursor will be at the end of the text so calling this method will result in an error.
public void replace(java.lang.String newWord)
newWord
- a new word to replace the word at the current cursor.public void replaceAll(java.lang.String newWord)
newWord
- a new word to replace all occurences of the word at the
current cursor.public void ignore()
public void ignoreAll()
protected void ignoreAll(java.util.List ignoreWords)
public void delete()
public java.lang.String[] getSuggestions()
public java.lang.String[] getSuggestions(java.lang.String word)
|
Jive Forums Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |