org.eclipse.xtext.ui.editor.model
Class CommonWordIterator

java.lang.Object
  extended by com.ibm.icu.text.BreakIterator
      extended by org.eclipse.xtext.ui.editor.model.CommonWordIterator
All Implemented Interfaces:
java.lang.Cloneable

public class CommonWordIterator
extends com.ibm.icu.text.BreakIterator

Copied from org.eclipse.jdt.internal.ui.text.JavaWordIterator.

See Also:
JavaWordIterator

Field Summary
 
Fields inherited from class com.ibm.icu.text.BreakIterator
DONE, KIND_CHARACTER, KIND_LINE, KIND_SENTENCE, KIND_TITLE, KIND_WORD
 
Constructor Summary
CommonWordIterator(boolean camelCase)
          Creates a new word iterator.
 
Method Summary
protected  CommonBreakIterator createIteratorDelegate(boolean camelCase)
           
 int current()
          Return the iterator's current position.
protected  boolean eatFollowingWhitespace(int offset, int exclusiveEnd)
           
 int first()
          Return the first boundary position.
 int following(int offset)
          Sets the iterator's current iteration position to be the first boundary position following the specified position.
 java.text.CharacterIterator getText()
          Returns a CharacterIterator over the text being analyzed.
protected  boolean isDelimiter(int offset, int exclusiveEnd)
          Returns true if the given sequence into the underlying text represents a delimiter, false otherwise.
protected  boolean isWhitespace(int offset, int exclusiveEnd)
          Returns true if the given sequence into the underlying text represents whitespace, but not a delimiter, false otherwise.
 int last()
          Return the last boundary position.
 int next()
          Advances the iterator forward one boundary.
 int next(int n)
          Advances the specified number of steps forward in the text (a negative number, therefore, advances backwards).
 int preceding(int offset)
          Sets the iterator's current iteration position to be the last boundary position preceding the specified position.
 int previous()
          Advances the iterator backward one boundary.
 void setText(java.text.CharacterIterator newText)
          Sets the iterator to analyze a new piece of text.
 void setText(java.lang.CharSequence newText)
          Sets the text as CharSequence.
 void setText(java.lang.String newText)
          Sets the iterator to analyze a new piece of text.
 
Methods inherited from class com.ibm.icu.text.BreakIterator
clone, getAvailableLocales, getAvailableULocales, getBreakInstance, getCharacterInstance, getCharacterInstance, getCharacterInstance, getLineInstance, getLineInstance, getLineInstance, getLocale, getSentenceInstance, getSentenceInstance, getSentenceInstance, getTitleInstance, getTitleInstance, getTitleInstance, getWordInstance, getWordInstance, getWordInstance, isBoundary, registerInstance, registerInstance, unregister
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommonWordIterator

public CommonWordIterator(boolean camelCase)
Creates a new word iterator.

Method Detail

createIteratorDelegate

protected CommonBreakIterator createIteratorDelegate(boolean camelCase)

first

public int first()
Description copied from class: com.ibm.icu.text.BreakIterator
Return the first boundary position. This is always the beginning index of the text this iterator iterates over. For example, if the iterator iterates over a whole string, this function will always return 0. This function also updates the iteration position to point to the beginning of the text.

Specified by:
first in class com.ibm.icu.text.BreakIterator
Returns:
The character offset of the beginning of the stretch of text being broken.

last

public int last()
Description copied from class: com.ibm.icu.text.BreakIterator
Return the last boundary position. This is always the "past-the-end" index of the text this iterator iterates over. For example, if the iterator iterates over a whole string (call it "text"), this function will always return text.length(). This function also updated the iteration position to point to the end of the text.

Specified by:
last in class com.ibm.icu.text.BreakIterator
Returns:
The character offset of the end of the stretch of text being broken.

next

public int next(int n)
Description copied from class: com.ibm.icu.text.BreakIterator
Advances the specified number of steps forward in the text (a negative number, therefore, advances backwards). If this causes the iterator to advance off either end of the text, this function returns DONE; otherwise, this function returns the position of the appropriate boundary. Calling this function is equivalent to calling next() or previous() n times.

Specified by:
next in class com.ibm.icu.text.BreakIterator
Parameters:
n - The number of boundaries to advance over (if positive, moves forward; if negative, moves backwards).
Returns:
The position of the boundary n boundaries from the current iteration position, or DONE if moving n boundaries causes the iterator to advance off either end of the text.

next

public int next()
Description copied from class: com.ibm.icu.text.BreakIterator
Advances the iterator forward one boundary. The current iteration position is updated to point to the next boundary position after the current position, and this is also the value that is returned. If the current position is equal to the value returned by last(), or to DONE, this function returns DONE and sets the current position to DONE.

Specified by:
next in class com.ibm.icu.text.BreakIterator
Returns:
The position of the first boundary position following the iteration position.

previous

public int previous()
Description copied from class: com.ibm.icu.text.BreakIterator
Advances the iterator backward one boundary. The current iteration position is updated to point to the last boundary position before the current position, and this is also the value that is returned. If the current position is equal to the value returned by first(), or to DONE, this function returns DONE and sets the current position to DONE.

Specified by:
previous in class com.ibm.icu.text.BreakIterator
Returns:
The position of the last boundary position preceding the iteration position.

preceding

public int preceding(int offset)
Description copied from class: com.ibm.icu.text.BreakIterator
Sets the iterator's current iteration position to be the last boundary position preceding the specified position. (Whether the specified position is itself a boundary position or not doesn't matter-- this function always moves the iteration position to the last boundary before the specified position.) If the specified position is the starting position, returns DONE.

Overrides:
preceding in class com.ibm.icu.text.BreakIterator
Parameters:
offset - The character position to start searching from.
Returns:
The position of the last boundary position preceding "offset" (whether of not "offset" itself is a boundary position), or DONE if "offset" is the starting offset of the iterator.

following

public int following(int offset)
Description copied from class: com.ibm.icu.text.BreakIterator
Sets the iterator's current iteration position to be the first boundary position following the specified position. (Whether the specified position is itself a boundary position or not doesn't matter-- this function always moves the iteration position to the first boundary after the specified position.) If the specified position is the past-the-end position, returns DONE.

Specified by:
following in class com.ibm.icu.text.BreakIterator
Parameters:
offset - The character position to start searching from.
Returns:
The position of the first boundary position following "offset" (whether or not "offset" itself is a boundary position), or DONE if "offset" is the past-the-end offset.

eatFollowingWhitespace

protected boolean eatFollowingWhitespace(int offset,
                                         int exclusiveEnd)

isDelimiter

protected boolean isDelimiter(int offset,
                              int exclusiveEnd)
Returns true if the given sequence into the underlying text represents a delimiter, false otherwise.

Parameters:
offset - the offset
exclusiveEnd - the end offset
Returns:
true if the given range is a delimiter

isWhitespace

protected boolean isWhitespace(int offset,
                               int exclusiveEnd)
Returns true if the given sequence into the underlying text represents whitespace, but not a delimiter, false otherwise.

Parameters:
offset - the offset
exclusiveEnd - the end offset
Returns:
true if the given range is whitespace

current

public int current()
Description copied from class: com.ibm.icu.text.BreakIterator
Return the iterator's current position.

Specified by:
current in class com.ibm.icu.text.BreakIterator
Returns:
The iterator's current position.

getText

public java.text.CharacterIterator getText()
Description copied from class: com.ibm.icu.text.BreakIterator
Returns a CharacterIterator over the text being analyzed. For at least some subclasses of BreakIterator, this is a reference to the actual iterator being used by the BreakIterator, and therefore, this function's return value should be treated as const. No guarantees are made about the current position of this iterator when it is returned. If you need to move that position to examine the text, clone this function's return value first.

Specified by:
getText in class com.ibm.icu.text.BreakIterator
Returns:
A CharacterIterator over the text being analyzed.

setText

public void setText(java.lang.CharSequence newText)
Sets the text as CharSequence.

Parameters:
newText - the new text

setText

public void setText(java.text.CharacterIterator newText)
Description copied from class: com.ibm.icu.text.BreakIterator
Sets the iterator to analyze a new piece of text. The BreakIterator is passed a CharacterIterator through which it will access the text itself. The current iteration position is reset to the CharacterIterator's start index. (The old iterator is dropped.)

Specified by:
setText in class com.ibm.icu.text.BreakIterator
Parameters:
newText - A CharacterIterator referring to the text to analyze with this BreakIterator (the iterator's current position is ignored, but its other state is significant).

setText

public void setText(java.lang.String newText)
Description copied from class: com.ibm.icu.text.BreakIterator
Sets the iterator to analyze a new piece of text. The new piece of text is passed in as a String, and the current iteration position is reset to the beginning of the string. (The old text is dropped.)

Overrides:
setText in class com.ibm.icu.text.BreakIterator
Parameters:
newText - A String containing the text to analyze with this BreakIterator.