1/* GENERATED SOURCE. DO NOT MODIFY. */ 2// © 2016 and later: Unicode, Inc. and others. 3// License & terms of use: http://www.unicode.org/copyright.html#License 4/* 5****************************************************************************** 6* Copyright (C) 1996-2016, International Business Machines Corporation and * 7* others. All Rights Reserved. * 8****************************************************************************** 9*/ 10 11package android.icu.util; 12 13/** 14 * <p>Interface for enabling iteration over sets of <int index, int value>, 15 * where index is the sorted integer index in ascending order and value, its 16 * associated integer value. 17 * <p>The result for each iteration is the consecutive range of 18 * <int index, int value> with the same value. Result is represented by 19 * <start, limit, value> where 20 * <ul> 21 * <li> start is the starting integer of the result range 22 * <li> limit is 1 after the maximum integer that follows start, such that 23 * all integers between start and (limit - 1), inclusive, have the same 24 * associated integer value. 25 * <li> value is the integer value that all integers from start to (limit - 1) 26 * share in common. 27 * </ul> 28 * <p> 29 * Hence value(start) = value(start + 1) = .... = value(start + n) = .... = 30 * value(limit - 1). However value(start -1) != value(start) and 31 * value(limit) != value(start). 32 * 33 * <p>Most implementations will be created by factory methods, such as the 34 * character type iterator in UCharacter.getTypeIterator. See example below. 35 * 36 * <p>Example of use:<br> 37 * <pre> 38 * RangeValueIterator iterator = UCharacter.getTypeIterator(); 39 * RangeValueIterator.Element result = new RangeValueIterator.Element(); 40 * while (iterator.next(result)) { 41 * System.out.println("Codepoint \\u" + 42 * Integer.toHexString(result.start) + 43 * " to codepoint \\u" + 44 * Integer.toHexString(result.limit - 1) + 45 * " has the character type " + result.value); 46 * } 47 * </pre> 48 * @author synwee 49 */ 50public interface RangeValueIterator 51{ 52 // public inner class --------------------------------------------- 53 54 /** 55 * Return result wrapper for android.icu.util.RangeValueIterator. 56 * Stores the start and limit of the continous result range and the 57 * common value all integers between [start, limit - 1] has. 58 */ 59 public class Element 60 { 61 // public data member --------------------------------------------- 62 63 /** 64 * Starting integer of the continuous result range that has the same 65 * value 66 */ 67 public int start; 68 /** 69 * (End + 1) integer of continuous result range that has the same 70 * value 71 */ 72 public int limit; 73 /** 74 * Gets the common value of the continous result range 75 */ 76 public int value; 77 78 // public constructor -------------------------------------------- 79 80 /** 81 * Empty default constructor to make javadoc happy 82 */ 83 public Element() 84 { 85 } 86 } 87 88 // public methods ------------------------------------------------- 89 90 /** 91 * <p>Returns the next maximal result range with a common value and returns 92 * true if we are not at the end of the iteration, false otherwise. 93 * <p>If this returns a false, the contents of elements will not 94 * be updated. 95 * @param element for storing the result range and value 96 * @return true if we are not at the end of the iteration, false otherwise. 97 * @see Element 98 */ 99 public boolean next(Element element); 100 101 /** 102 * Resets the iterator to the beginning of the iteration. 103 */ 104 public void reset(); 105} 106