javax.swing.text
Class SimpleAttributeSet.EmptyAttributeSet

java.lang.Object
  extended byjavax.swing.text.SimpleAttributeSet.EmptyAttributeSet
All Implemented Interfaces:
AttributeSet, Serializable
Enclosing class:
SimpleAttributeSet

static class SimpleAttributeSet.EmptyAttributeSet
extends Object
implements AttributeSet, Serializable

An AttributeSet this is always empty.


Nested Class Summary
 
Nested classes inherited from class javax.swing.text.AttributeSet
AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute
 
Field Summary
 
Fields inherited from interface javax.swing.text.AttributeSet
NameAttribute, ResolveAttribute
 
Constructor Summary
(package private) SimpleAttributeSet.EmptyAttributeSet()
           
 
Method Summary
 boolean containsAttribute(Object name, Object value)
          Returns true if this set contains this attribute with an equal value.
 boolean containsAttributes(AttributeSet attributes)
          Returns true if this set contains all the attributes with equal values.
 AttributeSet copyAttributes()
          Returns an attribute set that is guaranteed not to change over time.
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
 Object getAttribute(Object key)
          Fetches the value of the given attribute.
 int getAttributeCount()
          Returns the number of attributes contained in this set.
 Enumeration getAttributeNames()
          Returns an enumeration over the names of the attributes in the set.
 AttributeSet getResolveParent()
          Gets the resolving parent.
 int hashCode()
          Returns a hash code value for the object.
 boolean isDefined(Object attrName)
          Checks whether the named attribute has a value specified in the set without resolving through another attribute set.
 boolean isEqual(AttributeSet attr)
          Determines if the two attribute sets are equivalent.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleAttributeSet.EmptyAttributeSet

SimpleAttributeSet.EmptyAttributeSet()
Method Detail

getAttributeCount

public int getAttributeCount()
Description copied from interface: AttributeSet
Returns the number of attributes contained in this set.

Specified by:
getAttributeCount in interface AttributeSet
Returns:
the number of attributes >= 0

isDefined

public boolean isDefined(Object attrName)
Description copied from interface: AttributeSet
Checks whether the named attribute has a value specified in the set without resolving through another attribute set.

Specified by:
isDefined in interface AttributeSet
Parameters:
attrName - the attribute name
Returns:
true if the attribute has a value specified

isEqual

public boolean isEqual(AttributeSet attr)
Description copied from interface: AttributeSet
Determines if the two attribute sets are equivalent.

Specified by:
isEqual in interface AttributeSet
Parameters:
attr - an attribute set
Returns:
true if the sets are equivalent

copyAttributes

public AttributeSet copyAttributes()
Description copied from interface: AttributeSet
Returns an attribute set that is guaranteed not to change over time.

Specified by:
copyAttributes in interface AttributeSet
Returns:
a copy of the attribute set

getAttribute

public Object getAttribute(Object key)
Description copied from interface: AttributeSet
Fetches the value of the given attribute. If the value is not found locally, the search is continued upward through the resolving parent (if one exists) until the value is either found or there are no more parents. If the value is not found, null is returned.

Specified by:
getAttribute in interface AttributeSet
Parameters:
key - the non-null key of the attribute binding
Returns:
the value

getAttributeNames

public Enumeration getAttributeNames()
Description copied from interface: AttributeSet
Returns an enumeration over the names of the attributes in the set. The values of the Enumeration may be anything and are not constrained to a particular Object type. The set does not include the resolving parent, if one is defined.

Specified by:
getAttributeNames in interface AttributeSet
Returns:
the names

containsAttribute

public boolean containsAttribute(Object name,
                                 Object value)
Description copied from interface: AttributeSet
Returns true if this set contains this attribute with an equal value.

Specified by:
containsAttribute in interface AttributeSet
Parameters:
name - the non-null attribute name
value - the value
Returns:
true if the set contains the attribute with an equal value

containsAttributes

public boolean containsAttributes(AttributeSet attributes)
Description copied from interface: AttributeSet
Returns true if this set contains all the attributes with equal values.

Specified by:
containsAttributes in interface AttributeSet
Parameters:
attributes - the set of attributes to check against
Returns:
true if this set contains all the attributes with equal values

getResolveParent

public AttributeSet getResolveParent()
Description copied from interface: AttributeSet
Gets the resolving parent.

Specified by:
getResolveParent in interface AttributeSet
Returns:
the parent

equals

public boolean equals(Object obj)
Description copied from class: Object
Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any non-null reference values x and y, this method returns true if and only if x and y refer to the same object (x == y has the value true).

Note that it is generally necessary to override the hashCode method whenever this method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes.

Overrides:
equals in class Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.
See Also:
Object.hashCode(), Hashtable

hashCode

public int hashCode()
Description copied from class: Object
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.

The general contract of hashCode is:

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)

Overrides:
hashCode in class Object
Returns:
a hash code value for this object.
See Also:
Object.equals(java.lang.Object), Hashtable