Package com.ibm.icu.text
Class ReplaceableContextIterator
- java.lang.Object
-
- com.ibm.icu.text.ReplaceableContextIterator
-
- All Implemented Interfaces:
UCaseProps.ContextIterator
class ReplaceableContextIterator extends java.lang.Object implements UCaseProps.ContextIterator
Implementation of UCaseProps.ContextIterator, iterates over a Replaceable. See casetrn.cpp/utrans_rep_caseContextIterator(). See also UCharacter.StringContextIterator.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
contextLimit
protected int
contextStart
protected int
cpLimit
protected int
cpStart
protected int
dir
protected int
index
protected int
limit
protected boolean
reachedLimit
protected Replaceable
rep
-
Constructor Summary
Constructors Constructor Description ReplaceableContextIterator()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
didReachLimit()
Did forward context iteration with next() reach the iteration limit?int
getCaseMapCPStart()
Get the index of where the code point currently being case-mapped starts.int
next()
Iterate and return the next code point, moving in the direction determined by the reset() call.int
nextCaseMapCP()
Iterate forward through the string to fetch the next code point to be case-mapped, and set the context indexes for it.int
replace(java.lang.String text)
Replace the current code point by its case mapping, and update the indexes.void
reset(int direction)
Reset the iterator for forward or backward iteration.void
setContextLimits(int contextStart, int contextLimit)
Set the start and limit indexes for context iteration with next().void
setIndex(int index)
Set the index where nextCaseMapCP() is to start iterating.void
setLimit(int lim)
Set the iteration limit for nextCaseMapCP() to an index within the string.void
setText(Replaceable rep)
Set the text for iteration.
-
-
-
Field Detail
-
rep
protected Replaceable 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
-
-
Method Detail
-
setText
public void setText(Replaceable rep)
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 <0 when the iteration is done.
-
replace
public int replace(java.lang.String text)
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.ContextIterator
Reset the iterator for forward or backward iteration.- Specified by:
reset
in interfaceUCaseProps.ContextIterator
- Parameters:
direction
- >0: Begin iterating forward from the first code point after the one that is being case-mapped. <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.ContextIterator
Iterate and return the next code point, moving in the direction determined by the reset() call.- Specified by:
next
in interfaceUCaseProps.ContextIterator
- Returns:
- Next code point, or <0 when the iteration is done.
-
-