Package com.ibm.icu.impl
Class SimpleFilteredSentenceBreakIterator
- java.lang.Object
-
- com.ibm.icu.text.BreakIterator
-
- com.ibm.icu.impl.SimpleFilteredSentenceBreakIterator
-
- All Implemented Interfaces:
Cloneable
public class SimpleFilteredSentenceBreakIterator extends BreakIterator
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSimpleFilteredSentenceBreakIterator.Builder
-
Field Summary
-
Fields inherited from class com.ibm.icu.text.BreakIterator
DONE, KIND_CHARACTER, KIND_LINE, KIND_SENTENCE, KIND_TITLE, KIND_WORD, WORD_IDEO, WORD_IDEO_LIMIT, WORD_KANA, WORD_KANA_LIMIT, WORD_LETTER, WORD_LETTER_LIMIT, WORD_NONE, WORD_NONE_LIMIT, WORD_NUMBER, WORD_NUMBER_LIMIT
-
-
Constructor Summary
Constructors Constructor Description SimpleFilteredSentenceBreakIterator(BreakIterator adoptBreakIterator, CharsTrie forwardsPartialTrie, CharsTrie backwardsTrie)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()Clone method.intcurrent()Return the iterator's current position.booleanequals(Object obj)Compares this instance with the specified object and indicates if they are equal.intfirst()Set the iterator to the first boundary position.intfollowing(int offset)Sets the iterator's current iteration position to be the first boundary position following the specified position.CharacterIteratorgetText()Returns a CharacterIterator over the text being analyzed.inthashCode()Returns an integer hash code for this object.intlast()Set the iterator to the last boundary position.intnext()Advances the iterator forward one boundary.intnext(int n)Move the iterator by the specified number of steps in the text.intpreceding(int offset)Sets the iterator's current iteration position to be the last boundary position preceding the specified position.intprevious()Move the iterator backward one boundary.voidsetText(CharacterIterator newText)Sets the iterator to analyze a new piece of text.-
Methods inherited from class com.ibm.icu.text.BreakIterator
getAvailableLocales, getAvailableULocales, getBreakInstance, getCharacterInstance, getCharacterInstance, getCharacterInstance, getLineInstance, getLineInstance, getLineInstance, getLocale, getRuleStatus, getRuleStatusVec, getSentenceInstance, getSentenceInstance, getSentenceInstance, getTitleInstance, getTitleInstance, getTitleInstance, getWordInstance, getWordInstance, getWordInstance, isBoundary, registerInstance, registerInstance, setText, unregister
-
-
-
-
Constructor Detail
-
SimpleFilteredSentenceBreakIterator
public SimpleFilteredSentenceBreakIterator(BreakIterator adoptBreakIterator, CharsTrie forwardsPartialTrie, CharsTrie backwardsTrie)
- Parameters:
adoptBreakIterator- break iterator to adoptforwardsPartialTrie- forward & partial char trie to adoptbackwardsTrie- backward trie to adopt
-
-
Method Detail
-
next
public int next()
Description copied from class:BreakIteratorAdvances 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:
nextin classBreakIterator- Returns:
- The position of the first boundary position following the iteration position.
-
equals
public boolean equals(Object obj)
Description copied from class:ObjectCompares this instance with the specified object and indicates if they are equal. In order to be equal,omust represent the same object as this instance using a class-specific comparison. The general contract is that this comparison should be reflexive, symmetric, and transitive. Also, no object reference other than null is equal to null.The default implementation returns
trueonly ifthis == o. See Writing a correctequalsmethod if you intend implementing your ownequalsmethod.The general contract for the
equalsandObject.hashCode()methods is that ifequalsreturnstruefor any two objects, thenhashCode()must return the same value for these objects. This means that subclasses ofObjectusually override either both methods or neither of them.- Overrides:
equalsin classObject- Parameters:
obj- the object to compare this instance with.- Returns:
trueif the specified object is equal to thisObject;falseotherwise.- See Also:
Object.hashCode()
-
hashCode
public int hashCode()
Description copied from class:ObjectReturns an integer hash code for this object. By contract, any two objects for whichObject.equals(java.lang.Object)returnstruemust return the same hash code value. This means that subclasses ofObjectusually override both methods or neither method.Note that hash values must not change over time unless information used in equals comparisons also changes.
See Writing a correct
hashCodemethod if you intend implementing your ownhashCodemethod.- Overrides:
hashCodein classObject- Returns:
- this object's hash code.
- See Also:
Object.equals(java.lang.Object)
-
clone
public Object clone()
Description copied from class:BreakIteratorClone method. Creates another BreakIterator with the same behavior and current state as this one.- Overrides:
clonein classBreakIterator- Returns:
- The clone.
-
first
public int first()
Description copied from class:BreakIteratorSet the iterator to 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.- Specified by:
firstin classBreakIterator- Returns:
- The character offset of the beginning of the stretch of text being broken.
-
last
public int last()
Description copied from class:BreakIteratorSet the iterator to 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().- Specified by:
lastin classBreakIterator- Returns:
- The character offset of the end of the stretch of text being broken.
-
next
public int next(int n)
Description copied from class:BreakIteratorMove the iterator by the specified number of steps in the text. A positive number moves the iterator forward; a negative number moves the iterator backwards. If this causes the iterator to move 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:
nextin classBreakIterator- 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.
-
previous
public int previous()
Description copied from class:BreakIteratorMove 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:
previousin classBreakIterator- Returns:
- The position of the last boundary position preceding the iteration position.
-
following
public int following(int offset)
Description copied from class:BreakIteratorSets 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:
followingin classBreakIterator- 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.
-
current
public int current()
Description copied from class:BreakIteratorReturn the iterator's current position.- Specified by:
currentin classBreakIterator- Returns:
- The iterator's current position.
-
preceding
public int preceding(int offset)
Description copied from class:BreakIteratorSets 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:
precedingin classBreakIterator- 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.
-
getText
public CharacterIterator getText()
Description copied from class:BreakIteratorReturns 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:
getTextin classBreakIterator- Returns:
- A CharacterIterator over the text being analyzed.
-
setText
public void setText(CharacterIterator newText)
Description copied from class:BreakIteratorSets 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:
setTextin classBreakIterator- 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).
-
-