Package com.ibm.icu.text
Class ReplaceableContextIterator
java.lang.Object
com.ibm.icu.text.ReplaceableContextIterator
- All Implemented Interfaces:
UCaseProps.ContextIterator
Implementation of UCaseProps.ContextIterator, iterates over a Replaceable.
See casetrn.cpp/utrans_rep_caseContextIterator().
See also UCharacter.StringContextIterator.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected intprotected intprotected intprotected intprotected intprotected intprotected booleanprotected Replaceable -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanDid forward context iteration with next() reach the iteration limit?intGet the index of where the code point currently being case-mapped starts.intnext()Iterate and return the next code point, moving in the direction determined by the reset() call.intIterate forward through the string to fetch the next code point to be case-mapped, and set the context indexes for it.intReplace the current code point by its case mapping, and update the indexes.voidreset(int direction) Reset the iterator for forward or backward iteration.voidsetContextLimits(int contextStart, int contextLimit) Set the start and limit indexes for context iteration with next().voidsetIndex(int index) Set the index where nextCaseMapCP() is to start iterating.voidsetLimit(int lim) Set the iteration limit for nextCaseMapCP() to an index within the string.voidsetText(Replaceable rep) Set the text for iteration.
-
Field Details
-
rep
-
index
protected int index -
limit
protected int limit -
cpStart
protected int cpStart -
cpLimit
protected int cpLimit -
contextStart
protected int contextStart -
contextLimit
protected int contextLimit -
dir
protected int dir -
reachedLimit
protected boolean reachedLimit
-
-
Constructor Details
-
ReplaceableContextIterator
ReplaceableContextIterator()Constructor.- Parameters:
rep- Replaceable to iterate over.
-
-
Method Details
-
setText
Set the text for iteration.- Parameters:
rep- Iteration text.
-
setIndex
public void setIndex(int index) Set the index where nextCaseMapCP() is to start iterating.- Parameters:
index- Iteration start index for nextCaseMapCP().
-
getCaseMapCPStart
public int getCaseMapCPStart()Get the index of where the code point currently being case-mapped starts.- Returns:
- The start index of the current code point.
-
setLimit
public void setLimit(int lim) Set the iteration limit for nextCaseMapCP() to an index within the string. If the limit parameter is negative or past the string, then the string length is restored as the iteration limit.- Parameters:
lim- The iteration limit.
-
setContextLimits
public void setContextLimits(int contextStart, int contextLimit) Set the start and limit indexes for context iteration with next().- Parameters:
contextStart- Start of context for next().contextLimit- Limit of context for next().
-
nextCaseMapCP
public int nextCaseMapCP()Iterate forward through the string to fetch the next code point to be case-mapped, and set the context indexes for it.- Returns:
- The next code point to be case-mapped, or invalid input: '<'0 when the iteration is done.
-
replace
Replace the current code point by its case mapping, and update the indexes.- Parameters:
text- Replacement text.- Returns:
- The delta for the change of the text length.
-
didReachLimit
public boolean didReachLimit()Did forward context iteration with next() reach the iteration limit?- Returns:
- Boolean value.
-
reset
public void reset(int direction) Description copied from interface:UCaseProps.ContextIteratorReset the iterator for forward or backward iteration.- Specified by:
resetin interfaceUCaseProps.ContextIterator- Parameters:
direction- >0: Begin iterating forward from the first code point after the one that is being case-mapped. invalid input: '<'0: Begin iterating backward from the first code point before the one that is being case-mapped.
-
next
public int next()Description copied from interface:UCaseProps.ContextIteratorIterate and return the next code point, moving in the direction determined by the reset() call.- Specified by:
nextin interfaceUCaseProps.ContextIterator- Returns:
- Next code point, or invalid input: '<'0 when the iteration is done.
-