src/java.base/share/classes/java/text/CollationElementIterator.java
changeset 58288 48e480e56aad
parent 53018 8bf9268df0e2
equal deleted inserted replaced
58287:a7f16447085e 58288:48e480e56aad
     1 /*
     1 /*
     2  * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    42 import java.util.Vector;
    42 import java.util.Vector;
    43 import sun.text.CollatorUtilities;
    43 import sun.text.CollatorUtilities;
    44 import sun.text.normalizer.NormalizerBase;
    44 import sun.text.normalizer.NormalizerBase;
    45 
    45 
    46 /**
    46 /**
    47  * The <code>CollationElementIterator</code> class is used as an iterator
    47  * The {@code CollationElementIterator} class is used as an iterator
    48  * to walk through each character of an international string. Use the iterator
    48  * to walk through each character of an international string. Use the iterator
    49  * to return the ordering priority of the positioned character. The ordering
    49  * to return the ordering priority of the positioned character. The ordering
    50  * priority of a character, which we refer to as a key, defines how a character
    50  * priority of a character, which we refer to as a key, defines how a character
    51  * is collated in the given collation object.
    51  * is collated in the given collation object.
    52  *
    52  *
    66  * </pre>
    66  * </pre>
    67  * </blockquote>
    67  * </blockquote>
    68  * The key of a character is an integer composed of primary order(short),
    68  * The key of a character is an integer composed of primary order(short),
    69  * secondary order(byte), and tertiary order(byte). Java strictly defines
    69  * secondary order(byte), and tertiary order(byte). Java strictly defines
    70  * the size and signedness of its primitive data types. Therefore, the static
    70  * the size and signedness of its primitive data types. Therefore, the static
    71  * functions <code>primaryOrder</code>, <code>secondaryOrder</code>, and
    71  * functions {@code primaryOrder}, {@code secondaryOrder}, and
    72  * <code>tertiaryOrder</code> return <code>int</code>, <code>short</code>,
    72  * {@code tertiaryOrder} return {@code int}, {@code short},
    73  * and <code>short</code> respectively to ensure the correctness of the key
    73  * and {@code short} respectively to ensure the correctness of the key
    74  * value.
    74  * value.
    75  *
    75  *
    76  * <p>
    76  * <p>
    77  * Example of the iterator usage,
    77  * Example of the iterator usage,
    78  * <blockquote>
    78  * <blockquote>
    88  *  }
    88  *  }
    89  * </pre>
    89  * </pre>
    90  * </blockquote>
    90  * </blockquote>
    91  *
    91  *
    92  * <p>
    92  * <p>
    93  * <code>CollationElementIterator.next</code> returns the collation order
    93  * {@code CollationElementIterator.next} returns the collation order
    94  * of the next character. A collation order consists of primary order,
    94  * of the next character. A collation order consists of primary order,
    95  * secondary order and tertiary order. The data type of the collation
    95  * secondary order and tertiary order. The data type of the collation
    96  * order is <strong>int</strong>. The first 16 bits of a collation order
    96  * order is <strong>int</strong>. The first 16 bits of a collation order
    97  * is its primary order; the next 8 bits is the secondary order and the
    97  * is its primary order; the next 8 bits is the secondary order and the
    98  * last 8 bits is the tertiary order.
    98  * last 8 bits is the tertiary order.
    99  *
    99  *
   100  * <p><b>Note:</b> <code>CollationElementIterator</code> is a part of
   100  * <p><b>Note:</b> {@code CollationElementIterator} is a part of
   101  * <code>RuleBasedCollator</code> implementation. It is only usable
   101  * {@code RuleBasedCollator} implementation. It is only usable
   102  * with <code>RuleBasedCollator</code> instances.
   102  * with {@code RuleBasedCollator} instances.
   103  *
   103  *
   104  * @see                Collator
   104  * @see                Collator
   105  * @see                RuleBasedCollator
   105  * @see                RuleBasedCollator
   106  * @author             Helena Shih, Laura Werner, Richard Gillam
   106  * @author             Helena Shih, Laura Werner, Richard Gillam
   107  * @since 1.1
   107  * @since 1.1