com.ibm.icu.text
public class UnicodeSetIterator extends Object
To iterate over code points, use a loop like this:
UnicodeSetIterator it = new UnicodeSetIterator(set); while (set.next()) { if (set.codepoint != UnicodeSetIterator.IS_STRING) { processCodepoint(set.codepoint); } else { processString(set.string); } }
To iterate over code point ranges, use a loop like this:
UnicodeSetIterator it = new UnicodeSetIterator(set); while (set.nextRange()) { if (set.codepoint != UnicodeSetIterator.IS_STRING) { processCodepointRange(set.codepoint, set.codepointEnd); } else { processString(set.string); } }
UNKNOWN: ICU 2.0
Field Summary | |
---|---|
int | codepoint
Current code point, or the special value IS_STRING, if
the iterator points to a string. |
int | codepointEnd
When iterating over ranges using nextRange(),
codepointEnd contains the inclusive end of the
iteration range, if codepoint ! |
protected int | endElement |
static int | IS_STRING
Value of codepoint if the iterator points to a string.
|
protected int | nextElement |
String | string
If codepoint == IS_STRING, then string points
to the current string. |
Constructor Summary | |
---|---|
UnicodeSetIterator(UnicodeSet set)
Create an iterator over the given set. | |
UnicodeSetIterator()
Create an iterator over nothing. |
Method Summary | |
---|---|
String | getString()
Gets the current string from the iterator. |
protected void | loadRange(int range) |
boolean | next()
Returns the next element in the set, either a single code point
or a string. |
boolean | nextRange()
Returns the next element in the set, either a code point range
or a string. |
void | reset(UnicodeSet set)
Sets this iterator to visit the elements of the given set and
resets it to the start of that set. |
void | reset()
Resets this iterator to the start of the set. |
UNKNOWN: ICU 2.0
UNKNOWN: ICU 2.0
Deprecated: This API is ICU internal only.
UNKNOWN:
UNKNOWN: ICU 2.0
Deprecated: This API is ICU internal only.
UNKNOWN:
UNKNOWN: ICU 2.0
Parameters: set set to iterate over
UNKNOWN: ICU 2.0
UNKNOWN: ICU 2.0
Deprecated: This API is ICU internal only.
Gets the current string from the iterator. Only use after calling next(), not nextRange().UNKNOWN:
Deprecated: This API is ICU internal only.
UNKNOWN:
The order of iteration is all code points in sorted order, followed by all strings sorted order. codepointEnd is undefined after calling this method. string is undefined unless codepoint == IS_STRING. Do not mix calls to next() and nextRange() without calling reset() between them. The results of doing so are undefined.
Returns: true if there was another element in the set and this object contains the element.
UNKNOWN: ICU 2.0
The order of iteration is all code points ranges in sorted order, followed by all strings sorted order. Ranges are disjoint and non-contiguous. string is undefined unless codepoint == IS_STRING. Do not mix calls to next() and nextRange() without calling reset() between them. The results of doing so are undefined.
Returns: true if there was another element in the set and this object contains the element.
UNKNOWN: ICU 2.0
Parameters: set the set to iterate over.
UNKNOWN: ICU 2.0
UNKNOWN: ICU 2.0