# Class StyleContext.SmallAttributeSet

java.lang.Object
javax.swing.text.StyleContext.SmallAttributeSet

All Implemented Interfaces:
  `AttributeSet`

Enclosing class:
  `StyleContext`

public class StyleContext.SmallAttributeSet extends Object implements AttributeSet
This class holds a small number of attributes in an array. The storage format is key, value, key, value, etc. The size of the set is the length of the array divided by two. By default, this is the class that will be used to store attributes when held in the compact shareable form.

- ## Nested Class Summary

  ### Nested classes/interfaces declared in interface AttributeSet

  `AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute`
  Modifier and Type
  Interface
  Description
  `static interface`
  `AttributeSet.CharacterAttribute`
  This interface is the type signature that is expected to be present on any attribute key that contributes to character level presentation.
  `static interface`
  `AttributeSet.ColorAttribute`
  This interface is the type signature that is expected to be present on any attribute key that contributes to presentation of color.
  `static interface`
  `AttributeSet.FontAttribute`
  This interface is the type signature that is expected to be present on any attribute key that contributes to the determination of what font to use to render some text.
  `static interface`
  `AttributeSet.ParagraphAttribute`
  This interface is the type signature that is expected to be present on any attribute key that contributes to the paragraph level presentation.

- ## Field Summary

  ### Fields declared in interface AttributeSet

  `NameAttribute, ResolveAttribute`
  Modifier and Type
  Field
  Description
  `static final Object`
  `NameAttribute`
  Attribute name used to name the collection of attributes.
  `static final Object`
  `ResolveAttribute`
  Attribute name used to identify the resolving parent set of attributes, if one is defined.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SmallAttributeSet(Object[] attributes)`
  Constructs a SmallAttributeSet.
  `SmallAttributeSet(AttributeSet attrs)`
  Constructs a SmallAttributeSet.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `clone()`
  Clones a set of attributes.
  `boolean`
  `containsAttribute(Object name, Object value)`
  Checks whether a given attribute name/value is defined.
  `boolean`
  `containsAttributes(AttributeSet attrs)`
  Checks whether the attribute set contains all of the given attributes.
  `AttributeSet`
  `copyAttributes()`
  Copies a set of attributes.
  `boolean`
  `equals(Object obj)`
  Compares this object to the specified object.
  `Object`
  `getAttribute(Object key)`
  Gets the value of an attribute.
  `int`
  `getAttributeCount()`
  Gets the number of attributes that are defined.
  `Enumeration<?>`
  `getAttributeNames()`
  Gets the names of all attributes.
  `AttributeSet`
  `getResolveParent()`
  If not overridden, the resolving parent defaults to the parent element.
  `int`
  `hashCode()`
  Returns a hashcode for this set of attributes.
  `boolean`
  `isDefined(Object key)`
  Checks whether a given attribute is defined.
  `boolean`
  `isEqual(AttributeSet attr)`
  Checks whether two attribute sets are equal.
  `String`
  `toString()`
  Returns a string showing the key/value pairs.

  ### Methods declared in class Object

  `finalize, getClass, notify, notifyAll, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected void`
  `finalize()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Finalization is deprecated and subject to removal in a future release.
  `final Class<?>`
  `getClass()`
  Returns the runtime class of this `Object`.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `final void`
  `wait()`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
  `final void`
  `wait(long timeoutMillis)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
  `final void`
  `wait(long timeoutMillis, int nanos)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

- ## Constructor Details

  - ### SmallAttributeSet

    public SmallAttributeSet(Object[] attributes)
    Constructs a SmallAttributeSet.
    Parameters:
      `attributes` - the attributes

  - ### SmallAttributeSet

    public SmallAttributeSet(AttributeSet attrs)
    Constructs a SmallAttributeSet.
    Parameters:
      `attrs` - the attributes

- ## Method Details

  - ### toString

    public String toString()
    Returns a string showing the key/value pairs.
    Overrides:
      `toString` in class `Object`
    Returns:
      a string showing the key/value pairs

  - ### hashCode

    public int hashCode()
    Returns a hashcode for this set of attributes.
    Overrides:
      `hashCode` in class `Object`
    Returns:
      a hashcode value for this set of attributes.
    See Also:
      - `Object.equals(java.lang.Object)`
      - `System.identityHashCode(Object)`

  - ### equals

    public boolean equals(Object obj)
    Compares this object to the specified object. The result is `true` if the object is an equivalent set of attributes.
    Overrides:
      `equals` in class `Object`
    Parameters:
      `obj` - the object to compare with.
    Returns:
      `true` if the objects are equal; `false` otherwise.
    See Also:
      - `Object.hashCode()`
      - `HashMap`

  - ### clone

    public Object clone()
    Clones a set of attributes. Since the set is immutable, a clone is basically the same set.
    Overrides:
      `clone` in class `Object`
    Returns:
      the set of attributes
    See Also:
      - `Cloneable`

  - ### getAttributeCount

    public int getAttributeCount()
    Gets the number of attributes that are defined.
    Specified by:
      `getAttributeCount` in interface `AttributeSet`
    Returns:
      the number of attributes
    See Also:
      - `AttributeSet.getAttributeCount()`

  - ### isDefined

    public boolean isDefined(Object key)
    Checks whether a given attribute is defined.
    Specified by:
      `isDefined` in interface `AttributeSet`
    Parameters:
      `key` - the attribute key
    Returns:
      true if the attribute is defined
    See Also:
      - `AttributeSet.isDefined(Object)`

  - ### isEqual

    public boolean isEqual(AttributeSet attr)
    Checks whether two attribute sets are equal.
    Specified by:
      `isEqual` in interface `AttributeSet`
    Parameters:
      `attr` - the attribute set to check against
    Returns:
      true if the same
    See Also:
      - `AttributeSet.isEqual(AttributeSet)`

  - ### copyAttributes

    public AttributeSet copyAttributes()
    Copies a set of attributes.
    Specified by:
      `copyAttributes` in interface `AttributeSet`
    Returns:
      the copy
    See Also:
      - `AttributeSet.copyAttributes()`

  - ### getAttribute

    public Object getAttribute(Object key)
    Gets the value of an attribute.
    Specified by:
      `getAttribute` in interface `AttributeSet`
    Parameters:
      `key` - the attribute name
    Returns:
      the attribute value
    See Also:
      - `AttributeSet.getAttribute(Object)`

  - ### getAttributeNames

    public Enumeration<?> getAttributeNames()
    Gets the names of all attributes.
    Specified by:
      `getAttributeNames` in interface `AttributeSet`
    Returns:
      the attribute names
    See Also:
      - `AttributeSet.getAttributeNames()`

  - ### containsAttribute

    public boolean containsAttribute(Object name, Object value)
    Checks whether a given attribute name/value is defined.
    Specified by:
      `containsAttribute` in interface `AttributeSet`
    Parameters:
      `name` - the attribute name
      `value` - the attribute value
    Returns:
      true if the name/value is defined
    See Also:
      - `AttributeSet.containsAttribute(Object, Object)`

  - ### containsAttributes

    public boolean containsAttributes(AttributeSet attrs)
    Checks whether the attribute set contains all of the given attributes.
    Specified by:
      `containsAttributes` in interface `AttributeSet`
    Parameters:
      `attrs` - the attributes to check
    Returns:
      true if the element contains all the attributes
    See Also:
      - `AttributeSet.containsAttributes(AttributeSet)`

  - ### getResolveParent

    public AttributeSet getResolveParent()
    If not overridden, the resolving parent defaults to the parent element.
    Specified by:
      `getResolveParent` in interface `AttributeSet`
    Returns:
      the attributes from the parent
    See Also:
      - `AttributeSet.getResolveParent()`