Top Description Inners Methods
com.ibm.icu.util

public Interface RangeValueIterator

Known Direct Implementers
com.ibm.icu.impl.TrieIterator, com.ibm.icu.lang.UCharacter.UCharacterTypeIterator

Interface for enabling iteration over sets of <int index, int value>, 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 <int index, int value> with the same value. Result is represented by <start, limit, value> 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
ICU Status
Stable since ICU 2.6.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
RangeValueIterator.Element

Return result wrapper for com.ibm.icu.util.RangeValueIterator.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if we are not at the end of the iteration, false otherwise.
next
(RangeValueIterator.Element
for storing the result range and value
element
)

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

public void
reset()

Resets the iterator to the beginning of the iteration.

Method Detail

nextback to summary
public boolean next(RangeValueIterator.Element element)

Returns 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 this returns a false, the contents of elements will not be updated.

Parameters
element:RangeValueIterator.Element

for storing the result range and value

Returns:boolean

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

ICU Status
Stable since ICU 2.6.
See Also
Element
resetback to summary
public void reset()

Resets the iterator to the beginning of the iteration.

ICU Status
Stable since ICU 2.6.
com.ibm.icu.util back to summary

public Class RangeValueIterator.Element

extends Object
Class Inheritance

Return result wrapper for com.ibm.icu.util.RangeValueIterator. Stores the start and limit of the continuous result range and the common value all integers between [start, limit - 1] has.
ICU Status
Stable since ICU 2.6.

Field Summary

Modifier and TypeField and Description
public int
limit

(End + 1) integer of continuous result range that has the same value

public int
start

Starting integer of the continuous result range that has the same value

public int
value

Gets the common value of the continuous result range

Constructor Summary

AccessConstructor and Description
public
Element()

Empty default constructor to make javadoc happy

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

limitback to summary
public int limit

(End + 1) integer of continuous result range that has the same value

ICU Status
Stable since ICU 2.6.
startback to summary
public int start

Starting integer of the continuous result range that has the same value

ICU Status
Stable since ICU 2.6.
valueback to summary
public int value

Gets the common value of the continuous result range

ICU Status
Stable since ICU 2.6.

Constructor Detail

Elementback to summary
public Element()

Empty default constructor to make javadoc happy

ICU Status
Stable since ICU 2.4.