]> gitweb.fperrin.net Git - Dictionary.git/blobdiff - jars/icu4j-52_1/main/classes/core/src/com/ibm/icu/util/BytesTrie.java
Upgrade ICU4J.
[Dictionary.git] / jars / icu4j-52_1 / main / classes / core / src / com / ibm / icu / util / BytesTrie.java
similarity index 91%
rename from jars/icu4j-4_8_1_1/main/classes/core/src/com/ibm/icu/util/BytesTrie.java
rename to jars/icu4j-52_1/main/classes/core/src/com/ibm/icu/util/BytesTrie.java
index 8c3bc3e9ca8428b50beec9b9e2d1659e18175afe..77da888a275e9d14cb9f267ef1cbccbe8b80b3aa 100644 (file)
@@ -1,6 +1,6 @@
 /*
 *******************************************************************************
-*   Copyright (C) 2010-2011, International Business Machines
+*   Copyright (C) 2010-2012, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *******************************************************************************
 *   created on: 2010nov23
@@ -21,8 +21,7 @@ import java.util.NoSuchElementException;
  *
  * <p>This class is not intended for public subclassing.
  *
- * @draft ICU 4.8
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 4.8
  * @author Markus W. Scherer
  */
 public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
@@ -39,8 +38,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
      *
      * @param trieBytes Bytes array that contains the serialized trie.
      * @param offset Root offset of the trie in the array.
-     * @draft ICU 4.8
-     * @provisional This API might change or be removed in a future release.
+     * @stable ICU 4.8
      */
     public BytesTrie(byte[] trieBytes, int offset) {
         bytes_=trieBytes;
@@ -52,8 +50,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
      * Clones this trie reader object and its state,
      * but not the byte array which will be shared.
      * @return A shallow clone of this trie.
-     * @draft ICU 4.8
-     * @provisional This API might change or be removed in a future release.
+     * @stable ICU 4.8
      */
     @Override
     public Object clone() throws CloneNotSupportedException {
@@ -63,8 +60,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
     /**
      * Resets this trie to its initial state.
      * @return this
-     * @draft ICU 4.8
-     * @provisional This API might change or be removed in a future release.
+     * @stable ICU 4.8
      */
     public BytesTrie reset() {
         pos_=root_;
@@ -75,14 +71,12 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
     /**
      * BytesTrie state object, for saving a trie's current state
      * and resetting the trie back to this state later.
-     * @draft ICU 4.8
-     * @provisional This API might change or be removed in a future release.
+     * @stable ICU 4.8
      */
     public static final class State {
         /**
          * Constructs an empty State.
-         * @draft ICU 4.8
-         * @provisional This API might change or be removed in a future release.
+         * @stable ICU 4.8
          */
         public State() {}
         private byte[] bytes;
@@ -96,8 +90,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
      * @param state The State object to hold the trie's state.
      * @return this
      * @see #resetToState
-     * @draft ICU 4.8
-     * @provisional This API might change or be removed in a future release.
+     * @stable ICU 4.8
      */
     public BytesTrie saveState(State state) /*const*/ {
         state.bytes=bytes_;
@@ -115,8 +108,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
      *         or the state of a different trie
      * @see #saveState
      * @see #reset
-     * @draft ICU 4.8
-     * @provisional This API might change or be removed in a future release.
+     * @stable ICU 4.8
      */
     public BytesTrie resetToState(State state) {
         if(bytes_==state.bytes && bytes_!=null && root_==state.root) {
@@ -130,8 +122,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
 
     /**
      * Return values for BytesTrie.next(), CharsTrie.next() and similar methods.
-     * @draft ICU 4.8
-     * @provisional This API might change or be removed in a future release.
+     * @stable ICU 4.8
      */
     public enum Result {
         /**
@@ -139,16 +130,14 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
          * Once current()/next() return NO_MATCH,
          * all further calls to current()/next() will also return NO_MATCH,
          * until the trie is reset to its original state or to a saved state.
-         * @draft ICU 4.8
-         * @provisional This API might change or be removed in a future release.
+         * @stable ICU 4.8
          */
         NO_MATCH,
         /**
          * The input unit(s) continued a matching string
          * but there is no value for the string so far.
          * (It is a prefix of a longer string.)
-         * @draft ICU 4.8
-         * @provisional This API might change or be removed in a future release.
+         * @stable ICU 4.8
          */
         NO_VALUE,
         /**
@@ -156,8 +145,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
          * and there is a value for the string so far.
          * This value will be returned by getValue().
          * No further input byte/unit can continue a matching string.
-         * @draft ICU 4.8
-         * @provisional This API might change or be removed in a future release.
+         * @stable ICU 4.8
          */
         FINAL_VALUE,
         /**
@@ -165,8 +153,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
          * and there is a value for the string so far.
          * This value will be returned by getValue().
          * Another input byte/unit can continue a matching string.
-         * @draft ICU 4.8
-         * @provisional This API might change or be removed in a future release.
+         * @stable ICU 4.8
          */
         INTERMEDIATE_VALUE;
 
@@ -177,8 +164,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
         /**
          * Same as (result!=NO_MATCH).
          * @return true if the input bytes/units so far are part of a matching string/byte sequence.
-         * @draft ICU 4.8
-         * @provisional This API might change or be removed in a future release.
+         * @stable ICU 4.8
          */
         public boolean matches() { return this!=NO_MATCH; }
 
@@ -186,16 +172,14 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
          * Equivalent to (result==INTERMEDIATE_VALUE || result==FINAL_VALUE).
          * @return true if there is a value for the input bytes/units so far.
          * @see #getValue
-         * @draft ICU 4.8
-         * @provisional This API might change or be removed in a future release.
+         * @stable ICU 4.8
          */
         public boolean hasValue() { return ordinal()>=2; }
 
         /**
          * Equivalent to (result==NO_VALUE || result==INTERMEDIATE_VALUE).
          * @return true if another input byte/unit can continue a matching string.
-         * @draft ICU 4.8
-         * @provisional This API might change or be removed in a future release.
+         * @stable ICU 4.8
          */
         public boolean hasNext() { return (ordinal()&1)!=0; }
     }
@@ -204,8 +188,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
      * Determines whether the byte sequence so far matches, whether it has a value,
      * and whether another input byte can continue a matching byte sequence.
      * @return The match/value Result.
-     * @draft ICU 4.8
-     * @provisional This API might change or be removed in a future release.
+     * @stable ICU 4.8
      */
     public Result current() /*const*/ {
         int pos=pos_;
@@ -224,8 +207,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
      * @param inByte Input byte value. Values -0x100..-1 are treated like 0..0xff.
      *               Values below -0x100 and above 0xff will never match.
      * @return The match/value Result.
-     * @draft ICU 4.8
-     * @provisional This API might change or be removed in a future release.
+     * @stable ICU 4.8
      */
     public Result first(int inByte) {
         remainingMatchLength_=-1;
@@ -240,8 +222,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
      * @param inByte Input byte value. Values -0x100..-1 are treated like 0..0xff.
      *               Values below -0x100 and above 0xff will never match.
      * @return The match/value Result.
-     * @draft ICU 4.8
-     * @provisional This API might change or be removed in a future release.
+     * @stable ICU 4.8
      */
     public Result next(int inByte) {
         int pos=pos_;
@@ -282,8 +263,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
      * @param sIndex The start index of the byte sequence in s.
      * @param sLimit The (exclusive) end index of the byte sequence in s.
      * @return The match/value Result.
-     * @draft ICU 4.8
-     * @provisional This API might change or be removed in a future release.
+     * @stable ICU 4.8
      */
     public Result next(byte[] s, int sIndex, int sLimit) {
         if(sIndex>=sLimit) {
@@ -368,8 +348,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
      *
      * Do not call getValue() after Result.NO_MATCH or Result.NO_VALUE!
      * @return The value for the byte sequence so far.
-     * @draft ICU 4.8
-     * @provisional This API might change or be removed in a future release.
+     * @stable ICU 4.8
      */
     public int getValue() /*const*/ {
         int pos=pos_;
@@ -384,8 +363,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
      * @return The unique value in bits 32..1 with bit 0 set,
      *         if all byte sequences reachable from the current state
      *         map to the same value; otherwise returns 0.
-     * @draft ICU 4.8
-     * @provisional This API might change or be removed in a future release.
+     * @stable ICU 4.8
      */
     public long getUniqueValue() /*const*/ {
         int pos=pos_;
@@ -404,8 +382,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
      * @param out Each next byte is 0-extended to a char and appended to this object.
      *            (Only uses the out.append(c) method.)
      * @return The number of bytes which continue the byte sequence from here.
-     * @draft ICU 4.8
-     * @provisional This API might change or be removed in a future release.
+     * @stable ICU 4.8
      */
     public int getNextBytes(Appendable out) /*const*/ {
         int pos=pos_;
@@ -442,8 +419,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
     /**
      * Iterates from the current state of this trie.
      * @return A new BytesTrie.Iterator.
-     * @draft ICU 4.8
-     * @provisional This API might change or be removed in a future release.
+     * @stable ICU 4.8
      */
     public Iterator iterator() {
         return new Iterator(bytes_, pos_, remainingMatchLength_, 0);
@@ -454,8 +430,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
      * @param maxStringLength If 0, the iterator returns full strings/byte sequences.
      *                        Otherwise, the iterator returns strings with this maximum length.
      * @return A new BytesTrie.Iterator.
-     * @draft ICU 4.8
-     * @provisional This API might change or be removed in a future release.
+     * @stable ICU 4.8
      */
     public Iterator iterator(int maxStringLength) {
         return new Iterator(bytes_, pos_, remainingMatchLength_, maxStringLength);
@@ -468,8 +443,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
      * @param maxStringLength If 0, the iterator returns full strings/byte sequences.
      *                        Otherwise, the iterator returns strings with this maximum length.
      * @return A new BytesTrie.Iterator.
-     * @draft ICU 4.8
-     * @provisional This API might change or be removed in a future release.
+     * @stable ICU 4.8
      */
     public static Iterator iterator(byte[] trieBytes, int offset, int maxStringLength) {
         return new Iterator(trieBytes, offset, -1, maxStringLength);
@@ -477,8 +451,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
 
     /**
      * Return value type for the Iterator.
-     * @draft ICU 4.8
-     * @provisional This API might change or be removed in a future release.
+     * @stable ICU 4.8
      */
     public static final class Entry {
         private Entry(int capacity) {
@@ -487,32 +460,28 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
 
         /**
          * @return The length of the byte sequence.
-         * @draft ICU 4.8
-         * @provisional This API might change or be removed in a future release.
+         * @stable ICU 4.8
          */
         public int bytesLength() { return length; }
         /**
          * Returns a byte of the byte sequence.
          * @param index An index into the byte sequence.
          * @return The index-th byte sequence byte.
-         * @draft ICU 4.8
-         * @provisional This API might change or be removed in a future release.
+         * @stable ICU 4.8
          */
         public byte byteAt(int index) { return bytes[index]; }
         /**
          * Copies the byte sequence into a byte array.
          * @param dest Destination byte array.
          * @param destOffset Starting offset to where in dest the byte sequence is copied.
-         * @draft ICU 4.8
-         * @provisional This API might change or be removed in a future release.
+         * @stable ICU 4.8
          */
         public void copyBytesTo(byte[] dest, int destOffset) {
             System.arraycopy(bytes, 0, dest, destOffset, length);
         }
         /**
          * @return The byte sequence as a read-only ByteBuffer.
-         * @draft ICU 4.8
-         * @provisional This API might change or be removed in a future release.
+         * @stable ICU 4.8
          */
         public ByteBuffer bytesAsByteBuffer() {
             return ByteBuffer.wrap(bytes, 0, length).asReadOnlyBuffer();
@@ -520,8 +489,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
 
         /**
          * The value associated with the byte sequence.
-         * @draft ICU 4.8
-         * @provisional This API might change or be removed in a future release.
+         * @stable ICU 4.8
          */
         public int value;
 
@@ -549,8 +517,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
 
     /**
      * Iterator for all of the (byte sequence, value) pairs in a BytesTrie.
-     * @draft ICU 4.8
-     * @provisional This API might change or be removed in a future release.
+     * @stable ICU 4.8
      */
     public static final class Iterator implements java.util.Iterator<Entry> {
         private Iterator(byte[] trieBytes, int offset, int remainingMatchLength, int maxStringLength) {
@@ -575,8 +542,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
         /**
          * Resets this iterator to its initial state.
          * @return this
-         * @draft ICU 4.8
-         * @provisional This API might change or be removed in a future release.
+         * @stable ICU 4.8
          */
         public Iterator reset() {
             pos_=initialPos_;
@@ -594,8 +560,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
 
         /**
          * @return true if there are more elements.
-         * @draft ICU 4.8
-         * @provisional This API might change or be removed in a future release.
+         * @stable ICU 4.8
          */
         public boolean hasNext() /*const*/ { return pos_>=0 || !stack_.isEmpty(); }
 
@@ -608,8 +573,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
          * a real value of -1.
          * @return An Entry with the string and value of the next element.
          * @throws NoSuchElementException - iteration has no more elements.
-         * @draft ICU 4.8
-         * @provisional This API might change or be removed in a future release.
+         * @stable ICU 4.8
          */
         public Entry next() {
             int pos=pos_;
@@ -678,8 +642,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
         /**
          * Iterator.remove() is not supported.
          * @throws UnsupportedOperationException (always)
-         * @draft ICU 4.8
-         * @provisional This API might change or be removed in a future release.
+         * @stable ICU 4.8
          */
         public void remove() {
             throw new UnsupportedOperationException();