home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-20 | 2.8 KB | 88 lines |
- /*
- * @(#)AttributeSet.java 1.5 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;
-
- /**
- * This interface provides read-only access to a set of attributes.
- * An attribute is a name/value pair, identified by name. No two
- * attributes in a set can have the same name.
- *
- * <p>
- * Instances of AttributeSet can be mutable through additional
- * functions on the instance. Interfaces that accept
- * AttributeSet generally assume that the sets may
- * be referenced and not copied, thus callers must be careful not
- * to subsequently mutate these sets.
- * <p>
- * Implementors must be sure to properly implement equals and
- * hashCode, so that attribute sets may be compared and placed in
- * hash tables. This set is equal to another set if each set
- * is empty, or if the sets have the same number of attributes and
- * each attribute in this set has an attribute with an equal name
- * and value in the other set.
- * <p>
- * By definition, attributes placed in an attribute set must
- * always be immutable, even if the set itself is not. Thus
- * clients of AttributeSet can always take references to the
- * names and values of attributes and rely on these not changing.
- * The implementation of clone may also make this assumption to
- * avoid doing a deep clone of the attributes themselves.
- *
- * @see AttributedCharacterIterator
- * @see MutableAttributeSet
- */
- public interface AttributeSet extends Cloneable {
-
- /**
- * Returns true if the set is empty.
- */
- public boolean isEmpty();
-
- /**
- * Returns the number of attributes.
- */
- public int getSize();
-
- /**
- * Returns an enumeration over the names of the attributes in the set.
- * The elements of the enumeration are all Strings.
- */
- public Enumeration names();
-
- /**
- * Returns the value of the attribute with this name, or null if the
- * attribute is not defined.
- */
- public Object get(String attributeName);
-
- /**
- * Returns true if this set contains this attribute with an equal value,
- * or if the value is null and the attribute is not defined.
- */
- public boolean contains(String attributeName, Object value);
-
- /**
- * Returns true if this set contains all the attributes with equal values.
- */
- public boolean contains(AttributeSet attributes);
-
- /**
- * Return a clone of this attribute set.
- */
- public Object clone();
- }
-