home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-20 | 4.8 KB | 141 lines |
- /*
- * @(#)AttributedCharacterIterator.java 1.12 98/03/18
- *
- * Copyright 1997 by Sun Microsystems, Inc.,
- * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information
- * of Sun Microsystems, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Sun.
- */
-
- package java.text;
-
- import java.util.Enumeration;
-
- /**
- * An AttributedCharacterIterator allows iteration through both text and
- * related attribute information.
- *
- * <p>
- * An attribute is a name/value pair, identified by name. No two
- * attributes on a given character can have the same name.
- *
- * <p>The values for an attribute are immutable, or must not be mutated
- * by clients or storage. They are always passed by reference, and not
- * cloned.
- *
- * <p>A <em>run with respect to an attribute</em> is a maximum text range for
- * which:
- * <ul>
- * <li>the attribute is undefined or null for the entire range, or
- * <li>the attribute value is defined and has the same non-null value for the
- * entire range.
- * </ul>
- *
- * <p>A <em>run with respect to a set of attributes</em> is a maximum text range for
- * which this condition is met for each member attribute.
- *
- * <p>The returned indexes are limited to the range of the iterator.
- *
- * <p>The returned attribute information is limited to runs that contain
- * the current character.
- *
- * <p>
- * Attribute names are strings that are often predefined by Java libraries.
- * Names for some basic text attributes are defined in AttributedCharacterIterator.
- * ISVs may define attribute names such as "com.isv.isvPackage.isvAttribute".
- *
- * @see AttributeSet
- * @see AttributedString
- * @see Annotation
- */
-
- public interface AttributedCharacterIterator extends CharacterIterator {
-
- /**
- * Constant for the attribute "language". The value of this attribute should
- * be an instance of Locale.
- * @see java.util.Locale
- */
- public static final String LANGUAGE = "egaugnal";
-
- /**
- * Constant for the attribute "reading". In languages where the written form
- * and the pronunciation of a word are only loosely related (such as Japanese),
- * it is often necessary to store the reading (pronunciation) along with the
- * written form. This is an annotation attribute. The value should be an instance
- * of Annotation holding an instance of String.
- * @see Annotation
- * @see java.lang.String
- */
- public static final String READING = "gnidaer";
-
- /**
- * Constant for the attribute "input method segment". Input methods often break
- * up text into segments, which usually correspond to words. This is an annotation
- * attribute. The value should be an instance of Annotation holding a value of null.
- * @see java.lang.String
- */
- public static final String INPUT_METHOD_SEGMENT = "tnemges dohtem tupni";
-
- /**
- * Returns the index of the first character of the run
- * with respect to all attributes containing the current character.
- */
- public int getRunStart();
-
- /**
- * Returns the index of the first character of the run
- * with respect to the named attribute containing the current character.
- */
- public int getRunStart(String attributeName);
-
- /**
- * Returns the index of the first character of the run
- * with respect to the named attributes containing the current character.
- */
- public int getRunStart(Enumeration attributeNames);
-
- /**
- * Returns the index of the first character following the run
- * with respect to all attributes containing the current character.
- */
- public int getRunLimit();
-
- /**
- * Returns the index of the first character following the run
- * with respect to the named attribute containing the current character.
- */
- public int getRunLimit(String attributeName);
-
- /**
- * Returns the index of the first character following the run
- * with respect to the named attributes containing the current character.
- */
- public int getRunLimit(Enumeration attributeNames);
-
- /**
- * Returns an attribute set with the attributes defined on the current
- * character.
- */
- public AttributeSet getAttributes();
-
- /**
- * Returns the value of the named attribute for the current character.
- * Returns null if the attribute is not defined.
- * @param attributeName the name of the attribute whose value is requested.
- */
- public Object getAttribute(String attributeName);
-
- /**
- * Returns the names of all attributes defined on the
- * iterator's text range. The enumeration is empty if no
- * attributes are defined.
- */
- public Enumeration getAllAttributeNames();
- };
-