2 ******************************************************************************
3 * Copyright (C) 1996-2010, International Business Machines Corporation and *
4 * others. All Rights Reserved. *
5 ******************************************************************************
8 package com.ibm.icu.util;
11 * <p>Interface for enabling iteration over sets of <int index, int value>,
12 * where index is the sorted integer index in ascending order and value, its
13 * associated integer value.</p>
14 * <p>The result for each iteration is the consecutive range of
15 * <int index, int value> with the same value. Result is represented by
16 * <start, limit, value> where</p>
18 * <li> start is the starting integer of the result range
19 * <li> limit is 1 after the maximum integer that follows start, such that
20 * all integers between start and (limit - 1), inclusive, have the same
21 * associated integer value.
22 * <li> value is the integer value that all integers from start to (limit - 1)
26 * Hence value(start) = value(start + 1) = .... = value(start + n) = .... =
27 * value(limit - 1). However value(start -1) != value(start) and
28 * value(limit) != value(start).
30 * <p>Most implementations will be created by factory methods, such as the
31 * character type iterator in UCharacter.getTypeIterator. See example below.
35 * RangeValueIterator iterator = UCharacter.getTypeIterator();
36 * RangeValueIterator.Element result = new RangeValueIterator.Element();
37 * while (iterator.next(result)) {
38 * System.out.println("Codepoint \\u" +
39 * Integer.toHexString(result.start) +
40 * " to codepoint \\u" +
41 * Integer.toHexString(result.limit - 1) +
42 * " has the character type " + result.value);
48 public interface RangeValueIterator
50 // public inner class ---------------------------------------------
53 * Return result wrapper for com.ibm.icu.util.RangeValueIterator.
54 * Stores the start and limit of the continous result range and the
55 * common value all integers between [start, limit - 1] has.
60 // public data member ---------------------------------------------
63 * Starting integer of the continuous result range that has the same
69 * (End + 1) integer of continuous result range that has the same
75 * Gets the common value of the continous result range
80 // public constructor --------------------------------------------
83 * Empty default constructor to make javadoc happy
91 // public methods -------------------------------------------------
94 * <p>Returns the next maximal result range with a common value and returns
95 * true if we are not at the end of the iteration, false otherwise.</p>
96 * <p>If this returns a false, the contents of elements will not
98 * @param element for storing the result range and value
99 * @return true if we are not at the end of the iteration, false otherwise.
103 public boolean next(Element element);
106 * Resets the iterator to the beginning of the iteration.