com.ibm.textlayout.attributes
Class AttributeSet

java.lang.Object
  |
  +--com.ibm.textlayout.attributes.AttributeSet
All Implemented Interfaces:
java.util.Collection, java.util.Set

public final class AttributeSet
extends java.lang.Object
implements java.util.Set

An AttributeSet is an immutable collection of unique Objects. It has several operations which return new AttributeSet instances.


Field Summary
static AttributeSet EMPTY_SET
          An AttributeSet with no members.
 
Constructor Summary
AttributeSet()
          Create a new, empty AttributeSet.
AttributeSet(java.lang.Object elem)
          Create a new AttributeSet with the single element elem.
AttributeSet(java.lang.Object[] elems)
          Create a new AttributeSet containing the items in the array elems.
 
Method Summary
 boolean add(java.lang.Object o)
          Throws UnsupportedOperationException.
 boolean addAll(java.util.Collection coll)
          Throws UnsupportedOperationException.
 AttributeSet addElement(java.lang.Object element)
          Return an AttributeSet containing the elements of this set and the given element
 void clear()
          Throws UnsupportedOperationException.
 boolean contains(java.lang.Object o)
          Return true if this set contains the given Object
 boolean containsAll(java.util.Collection coll)
          Return true if this set contains all elements in the given Collection
 java.util.Enumeration elements()
          Return an Enumeration of the elements in this set.
 boolean equals(AttributeSet rhs)
           
 boolean equals(java.lang.Object rhs)
           
 AttributeSet intersectWith(AttributeSet s)
          Return an AttributeSet which is the intersection of this set with the given set.
 boolean isEmpty()
          Return true if the number of elements in this set is 0.
 java.util.Iterator iterator()
          Return an Iterator with the elements in this set.
 boolean remove(java.lang.Object o)
          Throws UnsupportedOperationException.
 boolean removeAll(java.util.Collection coll)
          Throws UnsupportedOperationException.
 boolean retainAll(java.util.Collection coll)
          Throws UnsupportedOperationException.
 int size()
          Return the number of elements in this set.
 AttributeSet subtract(AttributeSet s)
          Return an AttributeSet with the elements in this set which are not in the given set.
 java.lang.Object[] toArray()
          Return an array with the elements in this set.
 java.lang.Object[] toArray(java.lang.Object[] storage)
          Fill in the given array with the elements in this set.
 AttributeSet unionWith(AttributeSet s)
          Return an AttributeSet which is the union of this set with the given set.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Set
hashCode
 

Field Detail

EMPTY_SET

public static final AttributeSet EMPTY_SET
An AttributeSet with no members.
Constructor Detail

AttributeSet

public AttributeSet()
Create a new, empty AttributeSet. The set is semantically equivalent to EMPTY_SET.

AttributeSet

public AttributeSet(java.lang.Object elem)
Create a new AttributeSet with the single element elem.

AttributeSet

public AttributeSet(java.lang.Object[] elems)
Create a new AttributeSet containing the items in the array elems.
Method Detail

isEmpty

public boolean isEmpty()
Return true if the number of elements in this set is 0.
Specified by:
isEmpty in interface java.util.Set
Returns:
true if the number of elements in this set is 0

size

public int size()
Return the number of elements in this set.
Specified by:
size in interface java.util.Set
Returns:
the number of elements in this set

equals

public boolean equals(java.lang.Object rhs)
Specified by:
equals in interface java.util.Set
Overrides:
equals in class java.lang.Object

equals

public boolean equals(AttributeSet rhs)

contains

public boolean contains(java.lang.Object o)
Return true if this set contains the given Object
Specified by:
contains in interface java.util.Set
Returns:
true if this set contains o

containsAll

public boolean containsAll(java.util.Collection coll)
Return true if this set contains all elements in the given Collection
Specified by:
containsAll in interface java.util.Set
Parameters:
coll - the collection to compare with
Returns:
true if this set contains all elements in the given Collection

elements

public java.util.Enumeration elements()
Return an Enumeration of the elements in this set.
Returns:
an Enumeration of the elements in this set

iterator

public java.util.Iterator iterator()
Return an Iterator with the elements in this set.
Specified by:
iterator in interface java.util.Set
Returns:
an Iterator with the elements in this set. The Iterator cannot be used to modify this AttributeSet.

toArray

public java.lang.Object[] toArray(java.lang.Object[] storage)
Fill in the given array with the elements in this set.
Specified by:
toArray in interface java.util.Set
Parameters:
storage - an array to fill with this set's elements. The array cannot be null.
Returns:
the storage array.

toArray

public java.lang.Object[] toArray()
Return an array with the elements in this set.
Specified by:
toArray in interface java.util.Set
Returns:
an array with the elements in this set

add

public boolean add(java.lang.Object o)
Throws UnsupportedOperationException.
Specified by:
add in interface java.util.Set
Throws:
UnsupportedOperationException -  
See Also:
addElement(java.lang.Object)

remove

public boolean remove(java.lang.Object o)
Throws UnsupportedOperationException.
Specified by:
remove in interface java.util.Set
Throws:
UnsupportedOperationException -  

addAll

public boolean addAll(java.util.Collection coll)
Throws UnsupportedOperationException.
Specified by:
addAll in interface java.util.Set
Throws:
UnsupportedOperationException -  
See Also:
unionWith(com.ibm.textlayout.attributes.AttributeSet)

removeAll

public boolean removeAll(java.util.Collection coll)
Throws UnsupportedOperationException.
Specified by:
removeAll in interface java.util.Set
Throws:
UnsupportedOperationException -  
See Also:
subtract(com.ibm.textlayout.attributes.AttributeSet)

retainAll

public boolean retainAll(java.util.Collection coll)
Throws UnsupportedOperationException.
Specified by:
retainAll in interface java.util.Set
Throws:
UnsupportedOperationException -  
See Also:
intersectWith(com.ibm.textlayout.attributes.AttributeSet)

clear

public void clear()
Throws UnsupportedOperationException.
Specified by:
clear in interface java.util.Set
Throws:
UnsupportedOperationException -  
See Also:
EMPTY_SET

addElement

public AttributeSet addElement(java.lang.Object element)
Return an AttributeSet containing the elements of this set and the given element
Parameters:
element - the element to add
Returns:
an AttributeSet like this one, with element added

unionWith

public AttributeSet unionWith(AttributeSet s)
Return an AttributeSet which is the union of this set with the given set.
Parameters:
s - the set to union with
Returns:
an AttributeSet of the elements in this set or in s

intersectWith

public AttributeSet intersectWith(AttributeSet s)
Return an AttributeSet which is the intersection of this set with the given set.
Parameters:
s - the set to intersect with
Returns:
an AttributeSet of the elements in this set which are in s

subtract

public AttributeSet subtract(AttributeSet s)
Return an AttributeSet with the elements in this set which are not in the given set.
Parameters:
s - the set of elements to exclude
Returns:
an AttributeSet of the elements in this set which are not in s


Copyright (c) 2001 IBM Corporation and others.