35 * A PrintJobAttributeSet is just an {@link AttributeSet AttributeSet} whose 36 * constructors and mutating operations guarantee an additional invariant, 37 * namely that all attribute values in the PrintJobAttributeSet must be 38 * instances of interface {@link PrintJobAttribute PrintJobAttribute}. 39 * The {@link #add(Attribute) add(Attribute)}, and 40 * {@link #addAll(AttributeSet) >addAll(AttributeSet)} operations 41 * are respecified below to guarantee this additional invariant. 42 * 43 * @author Alan Kaminsky 44 */ 45 public interface PrintJobAttributeSet extends AttributeSet { 46 47 /** 48 * Adds the specified attribute value to this attribute set if it is not 49 * already present, first removing any existing value in the same 50 * attribute category as the specified attribute value (optional 51 * operation). 52 * 53 * @param attribute Attribute value to be added to this attribute set. 54 * 55 * @return <tt>true</tt> if this attribute set changed as a result of 56 * the call, i.e., the given attribute value was not already a 57 * member of this attribute set. 58 * 59 * @throws UnmodifiableSetException 60 * (unchecked exception) Thrown if this attribute set does not 61 * support the <CODE>add()</CODE> operation. 62 * @throws ClassCastException 63 * (unchecked exception) Thrown if the <CODE>attribute</CODE> is 64 * not an instance of interface 65 * {@link PrintJobAttribute PrintJobAttribute}. 66 * @throws NullPointerException 67 * (unchecked exception) Thrown if the <CODE>attribute</CODE> is null. 68 */ 69 public boolean add(Attribute attribute); 70 71 /** 72 * Adds all of the elements in the specified set to this attribute. 73 * The outcome is the same as if the 74 * {@link #add(Attribute) add(Attribute)} 75 * operation had been applied to this attribute set successively with 76 * each element from the specified set. If none of the categories in the 77 * specified set are the same as any categories in this attribute set, 78 * the <tt>addAll()</tt> operation effectively modifies this attribute 79 * set so that its value is the <i>union</i> of the two sets. 80 * <P> 81 * The behavior of the <CODE>addAll()</CODE> operation is unspecified if 82 * the specified set is modified while the operation is in progress. 83 * <P> 84 * If the <CODE>addAll()</CODE> operation throws an exception, the effect 85 * on this attribute set's state is implementation dependent; elements 86 * from the specified set before the point of the exception may or 87 * may not have been added to this attribute set. 88 * 89 * @param attributes whose elements are to be added to this attribute 90 * set. 91 * 92 * @return <tt>true</tt> if this attribute set changed as a result of 93 * the call. 94 * 95 * @throws UnmodifiableSetException 96 * (Unchecked exception) Thrown if this attribute set does not 97 * support the <tt>addAll()</tt> method. 98 * @throws ClassCastException 99 * (Unchecked exception) Thrown if some element in the specified 100 * set is not an instance of interface {@link PrintJobAttribute 101 * PrintJobAttribute}. 102 * @throws NullPointerException 103 * (Unchecked exception) Thrown if the specified set is null. 104 * 105 * @see #add(Attribute) 106 */ 107 public boolean addAll(AttributeSet attributes); 108 } | 35 * A PrintJobAttributeSet is just an {@link AttributeSet AttributeSet} whose 36 * constructors and mutating operations guarantee an additional invariant, 37 * namely that all attribute values in the PrintJobAttributeSet must be 38 * instances of interface {@link PrintJobAttribute PrintJobAttribute}. 39 * The {@link #add(Attribute) add(Attribute)}, and 40 * {@link #addAll(AttributeSet) >addAll(AttributeSet)} operations 41 * are respecified below to guarantee this additional invariant. 42 * 43 * @author Alan Kaminsky 44 */ 45 public interface PrintJobAttributeSet extends AttributeSet { 46 47 /** 48 * Adds the specified attribute value to this attribute set if it is not 49 * already present, first removing any existing value in the same 50 * attribute category as the specified attribute value (optional 51 * operation). 52 * 53 * @param attribute Attribute value to be added to this attribute set. 54 * 55 * @return {@code true} if this attribute set changed as a result of 56 * the call, i.e., the given attribute value was not already a 57 * member of this attribute set. 58 * 59 * @throws UnmodifiableSetException 60 * (unchecked exception) Thrown if this attribute set does not 61 * support the {@code add()} operation. 62 * @throws ClassCastException 63 * (unchecked exception) Thrown if the {@code attribute} is 64 * not an instance of interface 65 * {@link PrintJobAttribute PrintJobAttribute}. 66 * @throws NullPointerException 67 * (unchecked exception) Thrown if the {@code attribute} is null. 68 */ 69 public boolean add(Attribute attribute); 70 71 /** 72 * Adds all of the elements in the specified set to this attribute. 73 * The outcome is the same as if the 74 * {@link #add(Attribute) add(Attribute)} 75 * operation had been applied to this attribute set successively with 76 * each element from the specified set. If none of the categories in the 77 * specified set are the same as any categories in this attribute set, 78 * the {@code addAll()} operation effectively modifies this attribute 79 * set so that its value is the <i>union</i> of the two sets. 80 * <P> 81 * The behavior of the {@code addAll()} operation is unspecified if 82 * the specified set is modified while the operation is in progress. 83 * <P> 84 * If the {@code addAll()} operation throws an exception, the effect 85 * on this attribute set's state is implementation dependent; elements 86 * from the specified set before the point of the exception may or 87 * may not have been added to this attribute set. 88 * 89 * @param attributes whose elements are to be added to this attribute 90 * set. 91 * 92 * @return {@code true} if this attribute set changed as a result of 93 * the call. 94 * 95 * @throws UnmodifiableSetException 96 * (Unchecked exception) Thrown if this attribute set does not 97 * support the {@code addAll()} method. 98 * @throws ClassCastException 99 * (Unchecked exception) Thrown if some element in the specified 100 * set is not an instance of interface {@link PrintJobAttribute 101 * PrintJobAttribute}. 102 * @throws NullPointerException 103 * (Unchecked exception) Thrown if the specified set is null. 104 * 105 * @see #add(Attribute) 106 */ 107 public boolean addAll(AttributeSet attributes); 108 } |