diff options
author | Michael Koch <konqueror@gmx.de> | 2003-12-23 10:21:31 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2003-12-23 10:21:31 +0000 |
commit | c36d5c04b1be32439c125f35b7fa9d06c023dd62 (patch) | |
tree | 5fd9c9b6b07753d11449c69906384fe6779cb4dd /libjava/javax/print | |
parent | 5d027e7b0312df4d691c9e5fb90020e41a034af9 (diff) | |
download | gcc-c36d5c04b1be32439c125f35b7fa9d06c023dd62.zip gcc-c36d5c04b1be32439c125f35b7fa9d06c023dd62.tar.gz gcc-c36d5c04b1be32439c125f35b7fa9d06c023dd62.tar.bz2 |
2003-12-23 Michael Koch <konqueror@gmx.de>
* javax/print/attribute/AttributeSetUtilities.java
(verifyCategoryForValue): Renamed from verifyCategoryForAttribute.
* javax/print/attribute/HashAttributeSet.java
(HashAttributeSet): Call internal add methods, added missing
exceptions.
(add): Call addInternal, added exceptions to documentation.
(addInternal): New method.
(addAll): Call addAllInternal, added exception to documentation.
(addAllInternal): New method.
(clear): Added exception to documentation.
(remove): Likewise.
* javax/print/attribute/URISyntax.java
(serialVersionUID): Fixed value.
From-SVN: r74969
Diffstat (limited to 'libjava/javax/print')
-rw-r--r-- | libjava/javax/print/attribute/AttributeSetUtilities.java | 4 | ||||
-rw-r--r-- | libjava/javax/print/attribute/HashAttributeSet.java | 35 | ||||
-rw-r--r-- | libjava/javax/print/attribute/URISyntax.java | 2 |
3 files changed, 33 insertions, 8 deletions
diff --git a/libjava/javax/print/attribute/AttributeSetUtilities.java b/libjava/javax/print/attribute/AttributeSetUtilities.java index 444b097..65cf378 100644 --- a/libjava/javax/print/attribute/AttributeSetUtilities.java +++ b/libjava/javax/print/attribute/AttributeSetUtilities.java @@ -432,8 +432,8 @@ public final class AttributeSetUtilities * @exception IllegalArgumentException if the categories are not equal * @exception NullPointerException if category is null */ - public static void verifyCategoryForAttribute(Class category, - Attribute attribute) + public static void verifyCategoryForValue(Class category, + Attribute attribute) { if (category == null) throw new NullPointerException("object may not be null"); diff --git a/libjava/javax/print/attribute/HashAttributeSet.java b/libjava/javax/print/attribute/HashAttributeSet.java index 6adf37c..63b4105 100644 --- a/libjava/javax/print/attribute/HashAttributeSet.java +++ b/libjava/javax/print/attribute/HashAttributeSet.java @@ -124,7 +124,7 @@ public class HashAttributeSet implements AttributeSet, Serializable if (attribute == null) throw new NullPointerException(); - add(attribute); + addInternal(attribute, interfaceName); } /** @@ -142,7 +142,7 @@ public class HashAttributeSet implements AttributeSet, Serializable throw new NullPointerException(); for (int index = 0; index < attributes.length; index++) - add(attributes[index]); + addInternal(attributes[index], interfaceName); } /** @@ -150,14 +150,13 @@ public class HashAttributeSet implements AttributeSet, Serializable * * @exception ClassCastException if any element of attributes is not an * interface of interfaceName - * @exception NullPointerException if attributes or interfaceName is null */ public HashAttributeSet(AttributeSet attributes, Class interfaceName) { this(interfaceName); if (attributes != null) - addAll(attributes); + addAllInternal(attributes, interfaceName); } /** @@ -166,12 +165,24 @@ public class HashAttributeSet implements AttributeSet, Serializable * @param attribute the attribute to add * * @return true if the attribute set has changed, false otherwise + * + * @exception NullPointerException if attribute is null + * @exception UnmodifiableSetException if this attribute set does not + * support this action. */ public boolean add(Attribute attribute) { + return addInternal(attribute, interfaceName); + } + + private boolean addInternal(Attribute attribute, Class interfaceName) + { if (attribute == null) throw new NullPointerException("attribute may not be null"); + AttributeSetUtilities.verifyAttributeCategory(interfaceName, + this.interfaceName); + Object old = attributeMap.put (attribute.getCategory(), AttributeSetUtilities.verifyAttributeValue (attribute, interfaceName)); @@ -184,14 +195,22 @@ public class HashAttributeSet implements AttributeSet, Serializable * @param attributes the attributes to add * * @return true if the attribute set has changed, false otherwise + * + * @exception UnmodifiableSetException if this attribute set does not + * support this action. */ public boolean addAll(AttributeSet attributes) { + return addAllInternal(attributes, interfaceName); + } + + private boolean addAllInternal(AttributeSet attributes, Class interfaceName) + { boolean modified = false; Attribute[] array = attributes.toArray(); for (int index = 0; index < array.length; index++) - if (! add(array[index])) + if (addInternal(array[index], interfaceName)) modified = true; return modified; @@ -199,6 +218,9 @@ public class HashAttributeSet implements AttributeSet, Serializable /** * Removes all attributes from this attribute set. + * + * @exception UnmodifiableSetException if this attribute set does not + * support this action. */ public void clear() { @@ -285,6 +307,9 @@ public class HashAttributeSet implements AttributeSet, Serializable * @param attribute the attribute value of the entry to be removed * * @return true if the attribute set has changed, false otherwise. + * + * @exception UnmodifiableSetException if this attribute set does not + * support this action. */ public boolean remove(Attribute attribute) { diff --git a/libjava/javax/print/attribute/URISyntax.java b/libjava/javax/print/attribute/URISyntax.java index da2667d..56a2536 100644 --- a/libjava/javax/print/attribute/URISyntax.java +++ b/libjava/javax/print/attribute/URISyntax.java @@ -46,7 +46,7 @@ import java.net.URI; public abstract class URISyntax implements Cloneable, Serializable { - private static final long serialVersionUID = 3666874174847632203L; + private static final long serialVersionUID = -7842661210486401678L; private URI uri; |