Interface PrintServiceAttributeSet specifies the interface for a set of
print job attributes, i.e. printing attributes that implement interface
PrintServiceAttribute
. In the Print Service API,
the Print Service instance uses a PrintServiceAttributeSet to report the
status of the print service.
A PrintServiceAttributeSet is just an AttributeSet
whose constructors and mutating operations guarantee an additional
invariant,
namely that all attribute values in the PrintServiceAttributeSet must be
instances of interface PrintServiceAttribute
.
The add(Attribute)
, and
addAll(AttributeSet)
operations
are respecified below to guarantee this additional invariant.
Adds the specified attribute to this attribute set if it is not
already present, first removing any existing value in the same
attribute category as the specified attribute value.
Adds all of the elements in the specified set to this attribute.
The outcome is the same as if the =
add(Attribute)
operation had been applied to this attribute set successively with each
element from the specified set.
The behavior of the
addAll(AttributeSet)
operation is unspecified if the specified set is modified while
the operation is in progress.
If the addAll(AttributeSet)
operation throws an exception,
the effect on this attribute set's state is implementation dependent;
elements from the specified set before the point of the exception may
or may not have been added to this attribute set.
Removes all attributes from this attribute set.
Returns true if this attribute set contains an
attribute for the specified category.
Returns true if this attribute set contains the given
attribute value.
Compares the specified object with this attribute set for equality.
Returns true if the given object is also an attribute set and
the two attribute sets contain the same attribute category-attribute
value mappings. This ensures that the
equals() method works properly across different
implementations of the AttributeSet interface.
Returns the attribute value which this attribute set contains in the
given attribute category. Returns null if this attribute set
does not contain any attribute value in the given attribute category.
Returns the hash code value for this attribute set. The hash code of an
attribute set is defined to be the sum of the hash codes of each entry
in the AttributeSet.
This ensures that
t1.equals(t2) implies that
t1.hashCode()==t2.hashCode() for any two attribute sets
t1 and
t2, as required by the general contract of
Object.hashCode()
.
Returns true if this attribute set contains no attributes.
Removes the specified attribute from this attribute set if
present. If attribute
is null, then
remove()
does nothing and returns false.
Removes any attribute for this category from this attribute set if
present. If category
is null, then
remove()
does nothing and returns false.
Returns the number of attributes in this attribute set. If this
attribute set contains more than Integer.MAX_VALUE elements,
returns Integer.MAX_VALUE.
Returns an array of the attributes contained in this set.