com.tivoli.pd.jutil
Class PDAttrValues

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by java.util.HashSet
              extended by com.tivoli.pd.jutil.PDAttrValues
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.Set

public class PDAttrValues
extends java.util.HashSet
implements java.lang.Cloneable, java.io.Serializable

This class represents a collection of values for a particular PDAttr. This particular implementation is a Set, so duplicates are not allowed in a particular PDAttrValues object.

Modes: Local,Remote

See Also:
Serialized Form

Constructor Summary
PDAttrValues(PDBasicContext context)
          Constructs a new, empty set; the backing HashMap instance has default capacity and load factor, which is 0.75.
PDAttrValues(PDBasicContext context, java.util.Collection c)
          Constructs a new PDAttrValues containing the elements in the specified Collection.
 
Method Summary
 boolean add(java.lang.Object obj)
          Overrides the generic method in HashSet that allows objects of any type to be added to a Set.
 boolean add(PDAttrValue value)
          Adds the input PDAttrValue to this PDAttrValues.
 boolean addAll(java.util.Collection c)
          Adds all of the elements in the specified collection to this collection.
 java.lang.Object clone()
          Returns a clone of this object.
 byte[] encode()
           
 boolean equals(java.lang.Object obj)
          Indicates whether some other Object is equal to this one.
 int hashCode()
          Returns a hashcode for the current object.
 java.lang.String toString()
          Returns a String representation of this object.
 
Methods inherited from class java.util.HashSet
clear, contains, isEmpty, iterator, remove, size
 
Methods inherited from class java.util.AbstractSet
removeAll
 
Methods inherited from class java.util.AbstractCollection
containsAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
containsAll, removeAll, retainAll, toArray, toArray
 

Constructor Detail

PDAttrValues

public PDAttrValues(PDBasicContext context)
             throws PDException
Constructs a new, empty set; the backing HashMap instance has default capacity and load factor, which is 0.75.

Parameters:
context - the context that defines values for logging and tracing. Cannot be null.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

PDAttrValues

public PDAttrValues(PDBasicContext context,
                    java.util.Collection c)
             throws PDException
Constructs a new PDAttrValues containing the elements in the specified Collection.

Parameters:
context - the context that defines values for logging and tracing. Cannot be null.
c - the collection whose elements are to be placed into this set.
Throws:
PDException - if one or more of the elements in the Collection to be added are not PDAttrValue objects, or if no Collection is passed in. This exception may contain error and message codes defined in the product Error Message Reference document.
Method Detail

add

public boolean add(PDAttrValue value)
            throws PDException
Adds the input PDAttrValue to this PDAttrValues. If a PDAttrValue with the same value is already in the Set, the input PDAttrValue will replace it.

Parameters:
value - the value to be added.
Returns:
true if this Collection changed as a result of this call.
Throws:
PDException - if no PDAttrValue is passed in. This exception may contain error and message codes defined in the product Error Message Reference document.

add

public boolean add(java.lang.Object obj)
            throws java.lang.IllegalStateException,
                   java.lang.IllegalArgumentException,
                   java.lang.RuntimeException
Overrides the generic method in HashSet that allows objects of any type to be added to a Set. This method will throw an PDException if called with an object other than a PDAttrValue.

Specified by:
add in interface java.util.Collection
Specified by:
add in interface java.util.Set
Overrides:
add in class java.util.HashSet
Parameters:
obj - the value to be added.
Returns:
true if this Collection changed as a result of this call.
Throws:
java.lang.IllegalArgumentException - if called with an object other than a PDAttrValue.
java.lang.IllegalStateException
java.lang.RuntimeException

addAll

public boolean addAll(java.util.Collection c)
               throws java.lang.NullPointerException,
                      java.lang.ClassCastException
Adds all of the elements in the specified collection to this collection. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified collection is this collection, and this collection is non-empty.) This implementation iterates over the specified collection, and adds each PDAttrValue returned by the iterator to this collection, in turn. If any objects are returned by the iterator that are not PDAttrValue, a PDException is thrown.

Specified by:
addAll in interface java.util.Collection
Specified by:
addAll in interface java.util.Set
Overrides:
addAll in class java.util.AbstractCollection
Parameters:
c - The collection of PDAttrValue to add to the PDAttrValues If the contents of a PDAttrValue in the collection matches the contents of a PDAttrValue already in the set, it will not be added.
Returns:
true if this Collection changed as a result of this call.
Throws:
java.lang.ClassCastException - if the input Collection contains an object other than a PDAttrValue or NullPointerException if no Collection is passed in.
java.lang.NullPointerException

clone

public java.lang.Object clone()
Returns a clone of this object. This is implemented as a deep copy.

Overrides:
clone in class java.util.HashSet

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other Object is equal to this one. In particular, this implementation checks that the object is a PDAttrValues, and then compares each PDAttrValue.

Specified by:
equals in interface java.util.Collection
Specified by:
equals in interface java.util.Set
Overrides:
equals in class java.util.AbstractSet
Parameters:
obj - the object to be compared to this one.
Returns:
true if the PDAttrValues are identical, false otherwise.

toString

public java.lang.String toString()
Returns a String representation of this object.

Overrides:
toString in class java.util.AbstractCollection

hashCode

public int hashCode()
Returns a hashcode for the current object.

Specified by:
hashCode in interface java.util.Collection
Specified by:
hashCode in interface java.util.Set
Overrides:
hashCode in class java.util.AbstractSet

encode

public byte[] encode()