com.ibm.icu.text
Class UnicodeSetIterator

java.lang.Object
  |
  +--com.ibm.icu.text.UnicodeSetIterator

public final class UnicodeSetIterator
extends java.lang.Object

Class that allows simple iteration over a UnicodeSet.

Author:
M. Davis

Field Summary
 int codepoint
           
 int codepointEnd
           
static int IS_STRING
           
 java.lang.String string
           
 
Constructor Summary
UnicodeSetIterator()
          Create an iterator.
UnicodeSetIterator(UnicodeSet set)
          Create an iterator
 
Method Summary
 boolean getAbbreviated()
          Causes the interation to only to part of long ranges
 boolean next()
          Returns the next element in the set.
 boolean nextRange()
           
 void reset()
          Resets to the start, to allow the iteration to start over again.
 void reset(UnicodeSet set)
           
 void setAbbreviated(boolean abbr)
          Causes the interation to only to part of long ranges
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IS_STRING

public static int IS_STRING

codepoint

public int codepoint

codepointEnd

public int codepointEnd

string

public java.lang.String string
Constructor Detail

UnicodeSetIterator

public UnicodeSetIterator(UnicodeSet set)
Create an iterator
Parameters:
set - set to iterate over

UnicodeSetIterator

public UnicodeSetIterator()
Create an iterator. Convenience for when the contents are to be set later.
Method Detail

next

public boolean next()
Returns the next element in the set.
Returns:
true if there was another element in the set. if so, if codepoint == IS_STRING, the value is a string in the string field else the value is a single code point in the codepoint field.
You are guaranteed that the codepoints are in sorted order, and the strings are in sorted order, and that all code points are returned before any strings are returned.
Note also that the codepointEnd is undefined after calling this method.

nextRange

public boolean nextRange()
Returns:
true if there was another element in the set. if so, if codepoint == IS_STRING, the value is a string in the string field else the value is a range of codepoints in the fields.
Note that the codepoints are in sorted order, and the strings are in sorted order, and that all code points are returned before any strings are returned.
You are guaranteed that the ranges are in sorted order, and the strings are in sorted order, and that all ranges are returned before any strings are returned.
You are also guaranteed that ranges are disjoint and non-contiguous.
Note also that the codepointEnd is undefined after calling this method.

reset

public void reset(UnicodeSet set)
Parameters:
set - the set to iterate over. This allows reuse of the iterator.

reset

public void reset()
Resets to the start, to allow the iteration to start over again.

setAbbreviated

public void setAbbreviated(boolean abbr)
Causes the interation to only to part of long ranges

getAbbreviated

public boolean getAbbreviated()
Causes the interation to only to part of long ranges


Copyright (c) 2001 IBM Corporation and others.