Package com.ibm.icu.impl
Class CaseMapImpl.StringContextIterator
java.lang.Object
com.ibm.icu.impl.CaseMapImpl.StringContextIterator
- All Implemented Interfaces:
UCaseProps.ContextIterator
- Enclosing class:
- CaseMapImpl
public static final class CaseMapImpl.StringContextIterator
extends Object
implements UCaseProps.ContextIterator
Implementation of UCaseProps.ContextIterator, iterates over a String.
See ustrcase.c/utf16_caseContextIterator().
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.StringContextIterator
(CharSequence src, int cpStart, int cpLimit) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionint
int
Returns the limit of the code point that was last returned by nextCaseMapCP().int
Returns the start of the code point that was last returned by nextCaseMapCP().void
moveTo
(int i) void
Move to the iteration limit without fetching code points up to there.int
next()
Iterate and return the next code point, moving in the direction determined by the reset() call.int
Iterate forward through the string to fetch the next code point to be case-mapped, and set the context indexes for it.void
reset
(int direction) Reset the iterator for forward or backward iteration.void
setCPStartAndLimit
(int s, int l) void
setLimit
(int lim) Set the iteration limit for nextCaseMapCP() to an index within the string.
-
Field Details
-
s
-
index
protected int index -
limit
protected int limit -
cpStart
protected int cpStart -
cpLimit
protected int cpLimit -
dir
protected int dir
-
-
Constructor Details
-
StringContextIterator
Constructor.- Parameters:
src
- String to iterate over.
-
StringContextIterator
Constructor.- Parameters:
src
- String to iterate over.cpStart
- Start index of the current code point.cpLimit
- Limit index of the current code point.
-
-
Method Details
-
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.This limit does not affect the next() function which always iterates to the very end of the string.
- Parameters:
lim
- The iteration limit.
-
moveToLimit
public void moveToLimit()Move to the iteration limit without fetching code points up to there. -
moveTo
public void moveTo(int i) -
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.When the iteration limit is reached (and -1 is returned), getCPStart() will be at the iteration limit.
Iteration with next() does not affect the position for nextCaseMapCP().
- Returns:
- The next code point to be case-mapped, or <0 when the iteration is done.
-
setCPStartAndLimit
public void setCPStartAndLimit(int s, int l) -
getCPStart
public int getCPStart()Returns the start of the code point that was last returned by nextCaseMapCP(). -
getCPLimit
public int getCPLimit()Returns the limit of the code point that was last returned by nextCaseMapCP(). -
getCPLength
public int getCPLength() -
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.
-