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