Package com.ibm.icu.util
Class CodePointMap.StringIterator
- java.lang.Object
-
- com.ibm.icu.util.CodePointMap.StringIterator
-
- Direct Known Subclasses:
CodePointTrie.Fast.FastStringIterator
,CodePointTrie.Small.SmallStringIterator
- Enclosing class:
- CodePointMap
public class CodePointMap.StringIterator extends java.lang.Object
Iterates over code points of a string and fetches map values. This does not implement java.util.Iterator.void onString(CodePointMap map, CharSequence s, int start) { CodePointMap.StringIterator iter = map.stringIterator(s, start); while (iter.next()) { int end = iter.getIndex(); // code point from between start and end useValue(s, start, end, iter.getCodePoint(), iter.getValue()); start = end; } }
This class is not intended for public subclassing.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
c
Deprecated.This API is ICU internal only.protected java.lang.CharSequence
s
Deprecated.This API is ICU internal only.protected int
sIndex
Deprecated.This API is ICU internal only.protected int
value
Deprecated.This API is ICU internal only.
-
Constructor Summary
Constructors Modifier Constructor Description protected
StringIterator(java.lang.CharSequence s, int sIndex)
Deprecated.This API is ICU internal only.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getCodePoint()
int
getIndex()
int
getValue()
boolean
next()
Reads the next code point, post-increments the string index, and gets a value from the map.boolean
previous()
Reads the previous code point, pre-decrements the string index, and gets a value from the map.void
reset(java.lang.CharSequence s, int sIndex)
Resets the iterator to a new string and/or a new string index.
-
-
-
Field Detail
-
s
@Deprecated protected java.lang.CharSequence s
Deprecated.This API is ICU internal only.
-
sIndex
@Deprecated protected int sIndex
Deprecated.This API is ICU internal only.
-
c
@Deprecated protected int c
Deprecated.This API is ICU internal only.
-
value
@Deprecated protected int value
Deprecated.This API is ICU internal only.
-
-
Method Detail
-
reset
public void reset(java.lang.CharSequence s, int sIndex)
Resets the iterator to a new string and/or a new string index.- Parameters:
s
- string to iterate oversIndex
- string index where the iteration will start
-
next
public boolean next()
Reads the next code point, post-increments the string index, and gets a value from the map. Sets an implementation-defined error value if the code point is an unpaired surrogate.- Returns:
- true if the string index was not yet at the end of the string; otherwise the iterator did not advance
-
previous
public boolean previous()
Reads the previous code point, pre-decrements the string index, and gets a value from the map. Sets an implementation-defined error value if the code point is an unpaired surrogate.- Returns:
- true if the string index was not yet at the start of the string; otherwise the iterator did not advance
-
getIndex
public final int getIndex()
- Returns:
- the string index
-
getCodePoint
public final int getCodePoint()
- Returns:
- the code point
-
getValue
public final int getValue()
- Returns:
- the map value, or an implementation-defined error value if the code point is an unpaired surrogate
-
-