|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.icu.text.UnicodeSetIterator
public class UnicodeSetIterator
UnicodeSetIterator iterates over the contents of a UnicodeSet. It iterates over either code points or code point ranges. After all code points or ranges have been returned, it returns the multicharacter strings of the UnicodSet, if any.
To iterate over code points and multicharacter strings, use a loop like this:
for (UnicodeSetIterator it = new UnicodeSetIterator(set); it.next();) { processString(it.getString()); }
To iterate over code point ranges, use a loop like this:
for (UnicodeSetIterator it = new UnicodeSetIterator(set); it.nextRange();) { if (it.codepoint != UnicodeSetIterator.IS_STRING) { processCodepointRange(it.codepoint, it.codepointEnd); } else { processString(it.getString()); } }
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
Deprecated. This API is ICU internal only. |
static int |
IS_STRING
Value of codepoint if the iterator points to a string. |
protected int |
nextElement
Deprecated. This API is ICU internal only. |
String |
string
If codepoint == IS_STRING, then string points to the current string. |
Constructor Summary | |
---|---|
UnicodeSetIterator()
Create an iterator over nothing. |
|
UnicodeSetIterator(UnicodeSet set)
Create an iterator over the given set. |
Method Summary | |
---|---|
String |
getString()
Gets the current string from the iterator. |
protected void |
loadRange(int aRange)
Deprecated. This API is ICU internal only. |
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()
Resets this iterator to the start of the set. |
void |
reset(UnicodeSet uset)
Sets this iterator to visit the elements of the given set and resets it to the start of that set. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int IS_STRING
public int codepoint
public int codepointEnd
public String string
protected int endElement
protected int nextElement
Constructor Detail |
---|
public UnicodeSetIterator(UnicodeSet set)
set
- set to iterate overpublic UnicodeSetIterator()
Method Detail |
---|
public boolean next()
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.
public boolean nextRange()
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.
public void reset(UnicodeSet uset)
uset
- the set to iterate over.public void reset()
public String getString()
protected void loadRange(int aRange)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |