src/java.base/share/classes/java/text/AttributedCharacterIterator.java
author naoto
Tue, 15 Oct 2019 09:25:59 -0700
changeset 58603 2312d1a04c49
parent 57956 e0b8b019d2f5
permissions -rw-r--r--
8212749: DecimalFormat.setGroupingSize(int) allows setting negative grouping size 8231984: Clarify semantics of DecimalFormat.getGroupingSize(0) Reviewed-by: rriggs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
57956
e0b8b019d2f5 8229997: Apply java.io.Serial annotations in java.base
darcy
parents: 47216
diff changeset
     2
 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.text;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.InvalidObjectException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.io.Serializable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.util.HashMap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.util.Map;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.util.Set;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
/**
7503
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
    35
 * An {@code AttributedCharacterIterator} allows iteration through both text and
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * related attribute information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * An attribute is a key/value pair, identified by the key.  No two
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * attributes on a given character can have the same key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * <p>The values for an attribute are immutable, or must not be mutated
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * by clients or storage.  They are always passed by reference, and not
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * cloned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * <p>A <em>run with respect to an attribute</em> is a maximum text range for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * which:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * <ul>
7503
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
    49
 * <li>the attribute is undefined or {@code null} for the entire range, or
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
    50
 * <li>the attribute value is defined and has the same non-{@code null} value for the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *     entire range.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * <p>A <em>run with respect to a set of attributes</em> is a maximum text range for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * which this condition is met for each member attribute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 *
7503
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
    57
 * <p>When getting a run with no explicit attributes specified (i.e.,
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
    58
 * calling {@link #getRunStart()} and {@link #getRunLimit()}), any
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
    59
 * contiguous text segments having the same attributes (the same set
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
    60
 * of attribute/value pairs) are treated as separate runs if the
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
    61
 * attributes have been given to those text segments separately.
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
    62
 *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * <p>The returned indexes are limited to the range of the iterator.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * <p>The returned attribute information is limited to runs that contain
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * the current character.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * <p>
7503
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
    69
 * Attribute keys are instances of {@link AttributedCharacterIterator.Attribute} and its
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
    70
 * subclasses, such as {@link java.awt.font.TextAttribute}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * @see AttributedCharacterIterator.Attribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * @see java.awt.font.TextAttribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * @see AttributedString
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * @see Annotation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
public interface AttributedCharacterIterator extends CharacterIterator {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * Defines attribute keys that are used to identify text attributes. These
7503
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
    83
     * keys are used in {@code AttributedCharacterIterator} and {@code AttributedString}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * @see AttributedCharacterIterator
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * @see AttributedString
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    public static class Attribute implements Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        /**
7503
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
    92
         * The name of this {@code Attribute}. The name is used primarily by {@code readResolve}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
         * to look up the corresponding predefined instance when deserializing
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
         * an instance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
         * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        private String name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        // table of all instances in this class, used by readResolve
12848
da701d422d2c 7117230: clean up warnings in java.text
dbhole
parents: 7503
diff changeset
   100
        private static final Map<String, Attribute> instanceMap = new HashMap<>(7);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        /**
7503
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
   103
         * Constructs an {@code Attribute} with the given name.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   104
         *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   105
         * @param name the name of {@code Attribute}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        protected Attribute(String name) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
            this.name = name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
            if (this.getClass() == Attribute.class) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
                instanceMap.put(name, this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
         * Compares two objects for equality. This version only returns true
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   116
         * for {@code x.equals(y)} if {@code x} and {@code y} refer
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
         * to the same object, and guarantees this for all subclasses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        public final boolean equals(Object obj) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
            return super.equals(obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
         * Returns a hash code value for the object. This version is identical to
7503
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
   125
         * the one in {@code Object}, but is also final.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        public final int hashCode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
            return super.hashCode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
         * Returns a string representation of the object. This version returns the
7503
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
   133
         * concatenation of class name, {@code "("}, a name identifying the attribute
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
   134
         * and {@code ")"}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
            return getClass().getName() + "(" + name + ")";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
         * Returns the name of the attribute.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   142
         *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   143
         * @return the name of {@code Attribute}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        protected String getName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
            return name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
         * Resolves instances being deserialized to the predefined constants.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   151
         *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   152
         * @return the resolved {@code Attribute} object
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   153
         * @throws InvalidObjectException if the object to resolve is not
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   154
         *                                an instance of {@code Attribute}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
         */
57956
e0b8b019d2f5 8229997: Apply java.io.Serial annotations in java.base
darcy
parents: 47216
diff changeset
   156
        @java.io.Serial
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        protected Object readResolve() throws InvalidObjectException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
            if (this.getClass() != Attribute.class) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                throw new InvalidObjectException("subclass didn't correctly implement readResolve");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
12848
da701d422d2c 7117230: clean up warnings in java.text
dbhole
parents: 7503
diff changeset
   162
            Attribute instance = instanceMap.get(getName());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            if (instance != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                return instance;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
                throw new InvalidObjectException("unknown attribute name");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
         * Attribute key for the language of some text.
7503
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
   172
         * <p> Values are instances of {@link java.util.Locale Locale}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
         * @see java.util.Locale
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        public static final Attribute LANGUAGE = new Attribute("language");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
         * Attribute key for the reading of some text. In languages where the written form
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
         * and the pronunciation of a word are only loosely related (such as Japanese),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
         * it is often necessary to store the reading (pronunciation) along with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
         * written form.
7503
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
   182
         * <p>Values are instances of {@link Annotation} holding instances of {@link String}.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   183
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
         * @see Annotation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
         * @see java.lang.String
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        public static final Attribute READING = new Attribute("reading");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
         * Attribute key for input method segments. Input methods often break
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
         * up text into segments, which usually correspond to words.
7503
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
   192
         * <p>Values are instances of {@link Annotation} holding a {@code null} reference.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
         * @see Annotation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        public static final Attribute INPUT_METHOD_SEGMENT = new Attribute("input_method_segment");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        // make sure the serial version doesn't change between compiler versions
57956
e0b8b019d2f5 8229997: Apply java.io.Serial annotations in java.base
darcy
parents: 47216
diff changeset
   198
        @java.io.Serial
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        private static final long serialVersionUID = -9142742483513960612L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * Returns the index of the first character of the run
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * with respect to all attributes containing the current character.
7503
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
   206
     *
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
   207
     * <p>Any contiguous text segments having the same attributes (the
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
   208
     * same set of attribute/value pairs) are treated as separate runs
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
   209
     * if the attributes have been given to those text segments separately.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   210
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   211
     * @return the index of the first character of the run
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    public int getRunStart();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * Returns the index of the first character of the run
7503
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
   217
     * with respect to the given {@code attribute} containing the current character.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   218
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   219
     * @param attribute the desired attribute.
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   220
     * @return the index of the first character of the run
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    public int getRunStart(Attribute attribute);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * Returns the index of the first character of the run
7503
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
   226
     * with respect to the given {@code attributes} containing the current character.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   227
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   228
     * @param attributes a set of the desired attributes.
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   229
     * @return the index of the first character of the run
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    public int getRunStart(Set<? extends Attribute> attributes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * Returns the index of the first character following the run
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * with respect to all attributes containing the current character.
7503
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
   236
     *
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
   237
     * <p>Any contiguous text segments having the same attributes (the
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
   238
     * same set of attribute/value pairs) are treated as separate runs
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
   239
     * if the attributes have been given to those text segments separately.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   240
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   241
     * @return the index of the first character following the run
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    public int getRunLimit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     * Returns the index of the first character following the run
7503
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
   247
     * with respect to the given {@code attribute} containing the current character.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   248
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   249
     * @param attribute the desired attribute
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   250
     * @return the index of the first character following the run
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    public int getRunLimit(Attribute attribute);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * Returns the index of the first character following the run
7503
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
   256
     * with respect to the given {@code attributes} containing the current character.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   257
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   258
     * @param attributes a set of the desired attributes
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   259
     * @return the index of the first character following the run
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    public int getRunLimit(Set<? extends Attribute> attributes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     * Returns a map with the attributes defined on the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * character.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   266
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   267
     * @return a map with the attributes defined on the current character
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
    public Map<Attribute,Object> getAttributes();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    /**
7503
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
   272
     * Returns the value of the named {@code attribute} for the current character.
44968dff12a7 6203034: [AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)
okutsu
parents: 5506
diff changeset
   273
     * Returns {@code null} if the {@code attribute} is not defined.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   274
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   275
     * @param attribute the desired attribute
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   276
     * @return the value of the named {@code attribute} or {@code null}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
    public Object getAttribute(Attribute attribute);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     * Returns the keys of all attributes defined on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * iterator's text range. The set is empty if no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * attributes are defined.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   284
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 14342
diff changeset
   285
     * @return the keys of all attributes
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    public Set<Attribute> getAllAttributeKeys();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
};