Package com.ibm.icu.util
Class CodePointMap.StringIterator
java.lang.Object
com.ibm.icu.util.CodePointMap.StringIterator
- Enclosing class:
CodePointMap
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
FieldsModifier and TypeFieldDescriptionprotected int
Deprecated.This API is ICU internal only.protected CharSequence
Deprecated.This API is ICU internal only.protected int
Deprecated.This API is ICU internal only.protected int
Deprecated.This API is ICU internal only. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
StringIterator
(CharSequence s, int sIndex) Deprecated.This API is ICU internal only. -
Method Summary
Modifier and TypeMethodDescriptionfinal int
final int
getIndex()
final 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
(CharSequence s, int sIndex) Resets the iterator to a new string and/or a new string index.
-
Field Details
-
s
Deprecated.This API is ICU internal only. -
sIndex
Deprecated.This API is ICU internal only. -
c
Deprecated.This API is ICU internal only. -
value
Deprecated.This API is ICU internal only.
-
-
Constructor Details
-
StringIterator
Deprecated.This API is ICU internal only.
-
-
Method Details
-
reset
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
-