12ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller/* GENERATED SOURCE. DO NOT MODIFY. */
2f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert// © 2016 and later: Unicode, Inc. and others.
3f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert// License & terms of use: http://www.unicode.org/copyright.html#License
42ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller/*
52ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller *******************************************************************************
6bfab1e7fec36dff93fb980c546ad64a565faf9fcPaul Duffin * Copyright (C) 1996-2016, International Business Machines Corporation and    *
72ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * others. All Rights Reserved.                                                *
82ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller *******************************************************************************
92ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */
102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerpackage android.icu.text;
112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller/**
132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Interface that defines an API for forward-only iteration
142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * on text objects.
152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * This is a minimal interface for iteration without random access
162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * or backwards iteration. It is especially useful for wrapping
172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * streams with converters into an object for collation or
182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * normalization.
192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller *
202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p>Characters can be accessed in two ways: as code units or as
212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * code points.
222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Unicode code points are 21-bit integers and are the scalar values
232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * of Unicode characters. ICU uses the type <code>int</code> for them.
242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Unicode code units are the storage units of a given
252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Unicode/UCS Transformation Format (a character encoding scheme).
262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * With UTF-16, all code points can be represented with either one
272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * or two code units ("surrogates").
282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * String storage is typically based on code units, while properties
292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * of characters are typically determined using code point values.
302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Some processes may be designed to work with sequences of code units,
312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * or it may be known that all characters that are important to an
322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * algorithm can be represented with single code units.
33bfab1e7fec36dff93fb980c546ad64a565faf9fcPaul Duffin * Other processes will need to use the code point access functions.
342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller *
352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p>ForwardCharacterIterator provides next() to access
362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * a code unit and advance an internal position into the text object,
372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * similar to a <code>return text[position++]</code>.<br>
382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * It provides nextCodePoint() to access a code point and advance an internal
39bfab1e7fec36dff93fb980c546ad64a565faf9fcPaul Duffin * position.
402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller *
412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p>nextCodePoint() assumes that the current position is that of
422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * the beginning of a code point, i.e., of its first code unit.
432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * After nextCodePoint(), this will be true again.
442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * In general, access to code units and code points in the same
452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * iteration loop should not be mixed. In UTF-16, if the current position
462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * is on a second code unit (Low Surrogate), then only that code unit
47bfab1e7fec36dff93fb980c546ad64a565faf9fcPaul Duffin * is returned even by nextCodePoint().
482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller *
492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Usage:
502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>
512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller *  public void function1(UForwardCharacterIterator it) {
522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller *     int c;
532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller *     while((c=it.next())!=UForwardCharacterIterator.DONE) {
542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller *         // use c
552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller *      }
562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller *  }
572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * </code>
58836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide Only a subset of ICU is exposed in Android
591537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller *
602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */
612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerpublic interface UForwardCharacterIterator {
632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Indicator that we have reached the ends of the UTF16 text.
662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final int DONE = -1;
682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Returns the UTF16 code unit at index, and increments to the next
702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * code unit (post-increment semantics).  If index is out of
712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * range, DONE is returned, and the iterator is reset to the limit
722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * of the text.
732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return the next UTF16 code unit, or DONE if the index is at the limit
742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *         of the text.
752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public int next();
772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Returns the code point at index, and increments to the next code
802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * point (post-increment semantics).  If index does not point to a
812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * valid surrogate pair, the behavior is the same as
82bfab1e7fec36dff93fb980c546ad64a565faf9fcPaul Duffin     * <code>next()</code>.  Otherwise the iterator is incremented past
832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the surrogate pair, and the code point represented by the pair
842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * is returned.
852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return the next codepoint in text, or DONE if the index is at
862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *         the limit of the text.
872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public int nextCodePoint();
892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller}
91