com.ibm.icu.util

Interface RangeValueIterator

public interface RangeValueIterator

Interface for enabling iteration over sets of , where index is the sorted integer index in ascending order and value, its associated integer value.

The result for each iteration is the consecutive range of with the same value. Result is represented by where

Hence value(start) = value(start + 1) = .... = value(start + n) = .... = value(limit - 1). However value(start -1) != value(start) and value(limit) != value(start).

Most implementations will be created by factory methods, such as the character type iterator in UCharacter.getTypeIterator. See example below.

Example of use:
 RangeValueIterator iterator = UCharacter.getTypeIterator();
 RangeValueIterator.Element result = new RangeValueIterator.Element();
 while (iterator.next(result)) {
     System.out.println("Codepoint \\u" + 
                        Integer.toHexString(result.start) + 
                        " to codepoint \\u" +
                        Integer.toHexString(result.limit - 1) + 
                        " has the character type " + result.value);
 }
 

Author: synwee

UNKNOWN: ICU 2.6

Nested Class Summary
static classRangeValueIterator.Element
Return result wrapper for com.ibm.icu.util.RangeValueIterator.
Method Summary
booleannext(RangeValueIterator.Element element)

Gets the next maximal result range with a common value and returns true if we are not at the end of the iteration, false otherwise.

If the return boolean is a false, the contents of elements will not be updated.

voidreset()
Resets the iterator to the beginning of the iteration.

Method Detail

next

public boolean next(RangeValueIterator.Element element)

Gets the next maximal result range with a common value and returns true if we are not at the end of the iteration, false otherwise.

If the return boolean is a false, the contents of elements will not be updated.

Parameters: element for storing the result range and value

Returns: true if we are not at the end of the iteration, false otherwise.

See Also: Element

UNKNOWN: ICU 2.6

reset

public void reset()
Resets the iterator to the beginning of the iteration.

UNKNOWN: ICU 2.6