From cd5ad6e5d869f94105e614a86060e213a1172a73 Mon Sep 17 00:00:00 2001 From: mkoch Date: Sun, 21 Dec 2003 19:54:52 +0000 Subject: [PATCH] 2003-12-21 Michael Koch * javax/print/attribute/AttributeSetUtilities.java, javax/print/attribute/HashAttributeSet.java, javax/print/attribute/HashDocAttributeSet.java, javax/print/attribute/HashPrintJobAttributeSet.java, javax/print/attribute/HashPrintRequestAttributeSet.java, javax/print/attribute/HashPrintServiceAttributeSet.java: New files. * Makefile.am (ordinary_java_source_files): Added new files. * Makefile.in: Regenerated. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74914 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/ChangeLog | 11 + libjava/Makefile.am | 6 + libjava/Makefile.in | 12 + .../print/attribute/AttributeSetUtilities.java | 445 +++++++++++++++++++++ .../javax/print/attribute/HashAttributeSet.java | 341 ++++++++++++++++ .../javax/print/attribute/HashDocAttributeSet.java | 94 +++++ .../print/attribute/HashPrintJobAttributeSet.java | 94 +++++ .../attribute/HashPrintRequestAttributeSet.java | 94 +++++ .../attribute/HashPrintServiceAttributeSet.java | 94 +++++ 9 files changed, 1191 insertions(+) create mode 100644 libjava/javax/print/attribute/AttributeSetUtilities.java create mode 100644 libjava/javax/print/attribute/HashAttributeSet.java create mode 100644 libjava/javax/print/attribute/HashDocAttributeSet.java create mode 100644 libjava/javax/print/attribute/HashPrintJobAttributeSet.java create mode 100644 libjava/javax/print/attribute/HashPrintRequestAttributeSet.java create mode 100644 libjava/javax/print/attribute/HashPrintServiceAttributeSet.java diff --git a/libjava/ChangeLog b/libjava/ChangeLog index e993c56..4b9ccbb 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,5 +1,16 @@ 2003-12-21 Michael Koch + * javax/print/attribute/AttributeSetUtilities.java, + javax/print/attribute/HashAttributeSet.java, + javax/print/attribute/HashDocAttributeSet.java, + javax/print/attribute/HashPrintJobAttributeSet.java, + javax/print/attribute/HashPrintRequestAttributeSet.java, + javax/print/attribute/HashPrintServiceAttributeSet.java: New files. + * Makefile.am (ordinary_java_source_files): Added new files. + * Makefile.in: Regenerated. + +2003-12-21 Michael Koch + * javax/print/attribute/EnumSyntax.java, javax/print/attribute/SetOfIntegerSyntax.java: New files. * Makefile.am (ordinary_java_source_files): diff --git a/libjava/Makefile.am b/libjava/Makefile.am index 4aeb63f..461ccd8 100644 --- a/libjava/Makefile.am +++ b/libjava/Makefile.am @@ -1743,10 +1743,16 @@ javax/naming/ldap/UnsolicitedNotificationListener.java \ javax/naming/OperationNotSupportedException.java \ javax/print/attribute/Attribute.java \ javax/print/attribute/AttributeSet.java \ +javax/print/attribute/AttributeSetUtilities.java \ javax/print/attribute/DateTimeSyntax.java \ javax/print/attribute/DocAttribute.java \ javax/print/attribute/DocAttributeSet.java \ javax/print/attribute/EnumSyntax.java \ +javax/print/attribute/HashAttributeSet.java \ +javax/print/attribute/HashDocAttributeSet.java \ +javax/print/attribute/HashPrintJobAttributeSet.java \ +javax/print/attribute/HashPrintRequestAttributeSet.java \ +javax/print/attribute/HashPrintServiceAttributeSet.java \ javax/print/attribute/IntegerSyntax.java \ javax/print/attribute/PrintJobAttribute.java \ javax/print/attribute/PrintJobAttributeSet.java \ diff --git a/libjava/Makefile.in b/libjava/Makefile.in index acf9abc..278910f 100644 --- a/libjava/Makefile.in +++ b/libjava/Makefile.in @@ -1459,10 +1459,16 @@ javax/naming/ldap/UnsolicitedNotificationListener.java \ javax/naming/OperationNotSupportedException.java \ javax/print/attribute/Attribute.java \ javax/print/attribute/AttributeSet.java \ +javax/print/attribute/AttributeSetUtilities.java \ javax/print/attribute/DateTimeSyntax.java \ javax/print/attribute/DocAttribute.java \ javax/print/attribute/DocAttributeSet.java \ javax/print/attribute/EnumSyntax.java \ +javax/print/attribute/HashAttributeSet.java \ +javax/print/attribute/HashDocAttributeSet.java \ +javax/print/attribute/HashPrintJobAttributeSet.java \ +javax/print/attribute/HashPrintRequestAttributeSet.java \ +javax/print/attribute/HashPrintServiceAttributeSet.java \ javax/print/attribute/IntegerSyntax.java \ javax/print/attribute/PrintJobAttribute.java \ javax/print/attribute/PrintJobAttributeSet.java \ @@ -4068,10 +4074,16 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ .deps/javax/naming/spi/Resolver.P .deps/javax/naming/spi/StateFactory.P \ .deps/javax/print/attribute/Attribute.P \ .deps/javax/print/attribute/AttributeSet.P \ +.deps/javax/print/attribute/AttributeSetUtilities.P \ .deps/javax/print/attribute/DateTimeSyntax.P \ .deps/javax/print/attribute/DocAttribute.P \ .deps/javax/print/attribute/DocAttributeSet.P \ .deps/javax/print/attribute/EnumSyntax.P \ +.deps/javax/print/attribute/HashAttributeSet.P \ +.deps/javax/print/attribute/HashDocAttributeSet.P \ +.deps/javax/print/attribute/HashPrintJobAttributeSet.P \ +.deps/javax/print/attribute/HashPrintRequestAttributeSet.P \ +.deps/javax/print/attribute/HashPrintServiceAttributeSet.P \ .deps/javax/print/attribute/IntegerSyntax.P \ .deps/javax/print/attribute/PrintJobAttribute.P \ .deps/javax/print/attribute/PrintJobAttributeSet.P \ diff --git a/libjava/javax/print/attribute/AttributeSetUtilities.java b/libjava/javax/print/attribute/AttributeSetUtilities.java new file mode 100644 index 0000000..444b097 --- /dev/null +++ b/libjava/javax/print/attribute/AttributeSetUtilities.java @@ -0,0 +1,445 @@ +/* AttributeSetUtilities.java -- + Copyright (C) 2003 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +import java.io.Serializable; + +public final class AttributeSetUtilities +{ + private static class UnmodifiableAttributeSet + implements AttributeSet, Serializable + { + private AttributeSet set; + + public UnmodifiableAttributeSet(AttributeSet attributeSet) + { + if (attributeSet == null) + throw new NullPointerException("attributeSet may not be null"); + + this.set = attributeSet; + } + + public boolean add(Attribute attribute) + { + throw new UnmodifiableSetException(); + } + + public boolean addAll(AttributeSet attributes) + { + throw new UnmodifiableSetException(); + } + + public void clear() + { + throw new UnmodifiableSetException(); + } + + public boolean containsKey(Class category) + { + return set.containsKey(category); + } + + public boolean containsValue(Attribute attribute) + { + return set.containsValue(attribute); + } + + public boolean equals(Object obj) + { + return set.equals(obj); + } + + public Attribute get(Class interfaceName) + { + return set.get(interfaceName); + } + + public int hashCode() + { + return set.hashCode(); + } + + public boolean isEmpty() + { + return set.isEmpty(); + } + + public boolean remove(Class category) + { + throw new UnmodifiableSetException(); + } + + public boolean remove(Attribute attribute) + { + throw new UnmodifiableSetException(); + } + + public int size() + { + return set.size(); + } + + public Attribute[] toArray() + { + return set.toArray(); + } + } + + public static class UnmodifiableDocAttributeSet + extends UnmodifiableAttributeSet + implements DocAttributeSet, Serializable + { + public UnmodifiableDocAttributeSet(DocAttributeSet attributeSet) + { + super(attributeSet); + } + } + + public static class UnmodifiablePrintJobAttributeSet + extends UnmodifiableAttributeSet + implements PrintJobAttributeSet, Serializable + { + public UnmodifiablePrintJobAttributeSet(PrintJobAttributeSet attributeSet) + { + super(attributeSet); + } + } + + public static class UnmodifiablePrintRequestAttributeSet + extends UnmodifiableAttributeSet + implements PrintRequestAttributeSet, Serializable + { + public UnmodifiablePrintRequestAttributeSet(PrintRequestAttributeSet attributeSet) + { + super(attributeSet); + } + } + + public static class UnmodifiablePrintServiceAttributeSet + extends UnmodifiableAttributeSet + implements PrintServiceAttributeSet, Serializable + { + public UnmodifiablePrintServiceAttributeSet(PrintServiceAttributeSet attributeSet) + { + super(attributeSet); + } + } + + public static class SynchronizedAttributeSet + implements AttributeSet, Serializable + { + private AttributeSet set; + + public SynchronizedAttributeSet(AttributeSet attributeSet) + { + if (attributeSet == null) + throw new NullPointerException("attributeSet may not be null"); + + this.set = attributeSet; + } + + public synchronized boolean add(Attribute attribute) + { + return set.add(attribute); + } + + public synchronized boolean addAll(AttributeSet attributes) + { + return set.addAll(attributes); + } + + public synchronized void clear() + { + set.clear(); + } + + public synchronized boolean containsKey(Class category) + { + return set.containsKey(category); + } + + public synchronized boolean containsValue(Attribute attribute) + { + return set.containsValue(attribute); + } + + public synchronized boolean equals(Object obj) + { + return set.equals(obj); + } + + public synchronized Attribute get(Class interfaceName) + { + return set.get(interfaceName); + } + + public synchronized int hashCode() + { + return set.hashCode(); + } + + public synchronized boolean isEmpty() + { + return set.isEmpty(); + } + + public synchronized boolean remove(Class category) + { + return set.remove(category); + } + + public synchronized boolean remove(Attribute attribute) + { + return set.remove(attribute); + } + + public synchronized int size() + { + return set.size(); + } + + public synchronized Attribute[] toArray() + { + return set.toArray(); + } + } + + public static class SynchronizedDocAttributeSet + extends SynchronizedAttributeSet + implements DocAttributeSet, Serializable + { + public SynchronizedDocAttributeSet(DocAttributeSet attributeSet) + { + super(attributeSet); + } + } + + public static class SynchronizedPrintJobAttributeSet + extends SynchronizedAttributeSet + implements PrintJobAttributeSet, Serializable + { + public SynchronizedPrintJobAttributeSet(PrintJobAttributeSet attributeSet) + { + super(attributeSet); + } + } + + public static class SynchronizedPrintRequestAttributeSet + extends SynchronizedAttributeSet + implements PrintRequestAttributeSet, Serializable + { + public SynchronizedPrintRequestAttributeSet(PrintRequestAttributeSet attributeSet) + { + super(attributeSet); + } + } + + public static class SynchronizedPrintServiceAttributeSet + extends SynchronizedAttributeSet + implements PrintServiceAttributeSet, Serializable + { + public SynchronizedPrintServiceAttributeSet(PrintServiceAttributeSet attributeSet) + { + super(attributeSet); + } + } + + /** + * Returns a synchronized view of the given attribute set. + * + * @return the sychronized attribute set + */ + public static AttributeSet synchronizedView(AttributeSet attributeSet) + { + return new SynchronizedAttributeSet(attributeSet); + } + + /** + * Returns a synchronized view of the given attribute set. + * + * @return the sychronized attribute set + */ + public static DocAttributeSet synchronizedView(DocAttributeSet attributeSet) + { + return new SynchronizedDocAttributeSet(attributeSet); + } + + /** + * Returns a synchronized view of the given attribute set. + * + * @return the sychronized attribute set + */ + public static PrintJobAttributeSet synchronizedView(PrintJobAttributeSet attributeSet) + { + return new SynchronizedPrintJobAttributeSet(attributeSet); + } + + /** + * Returns a synchronized view of the given attribute set. + * + * @return the sychronized attribute set + */ + public static PrintRequestAttributeSet synchronizedView(PrintRequestAttributeSet attributeSet) + { + return new SynchronizedPrintRequestAttributeSet(attributeSet); + } + + /** + * Returns a synchronized view of the given attribute set. + * + * @return the sychronized attribute set + */ + public static PrintServiceAttributeSet synchronizedView(PrintServiceAttributeSet attributeSet) + { + return new SynchronizedPrintServiceAttributeSet(attributeSet); + } + + /** + * Returns an unmodifiable view of the given attribute set. + * + * @return the sychronized attribute set + */ + public static AttributeSet unmodifiableView(AttributeSet attributeSet) + { + return new UnmodifiableAttributeSet(attributeSet); + } + + /** + * Returns an unmodifiable view of the given attribute set. + * + * @return the sychronized attribute set + */ + public static DocAttributeSet unmodifiableView(DocAttributeSet attributeSet) + { + return new UnmodifiableDocAttributeSet(attributeSet); + } + + /** + * Returns an unmodifiable view of the given attribute set. + * + * @return the sychronized attribute set + */ + public static PrintJobAttributeSet unmodifiableView(PrintJobAttributeSet attributeSet) + { + return new UnmodifiablePrintJobAttributeSet(attributeSet); + } + + /** + * Returns an unmodifiable view of the given attribute set. + * + * @return the sychronized attribute set + */ + public static PrintRequestAttributeSet unmodifiableView(PrintRequestAttributeSet attributeSet) + { + return new UnmodifiablePrintRequestAttributeSet(attributeSet); + } + + /** + * Returns an unmodifiable view of the given attribute set. + * + * @return the sychronized attribute set + */ + public static PrintServiceAttributeSet unmodifiableView(PrintServiceAttributeSet attributeSet) + { + return new UnmodifiablePrintServiceAttributeSet(attributeSet); + } + + /** + * Verifies that the given object is a Class that + * implements the given interface name. + * + * @return object casted to Class + * + * @exception ClassCastException if object is not a Class + * that implements interfaceName + * @exception NullPointerException if object is null + */ + public static Class verifyAttributeCategory(Object object, + Class interfaceName) + { + if (object == null) + throw new NullPointerException("object may not be null"); + + Class clazz = (Class) object; + + if (interfaceName.isAssignableFrom(clazz)) + return clazz; + + throw new ClassCastException(); + } + + /** + * Verifies that the given object is an attribute of the given interface. + * + * @return the object casted to Attribute + * + * @exception ClassCastException if object is no instance of interfaceName. + * @exception NullPointerException if object is null + */ + public static Attribute verifyAttributeValue(Object object, + Class interfaceName) + { + if (object == null) + throw new NullPointerException("object may not be null"); + + if (interfaceName.isInstance(object)) + return (Attribute) object; + + throw new ClassCastException(); + } + + /** + * Verifies that the category of attribute is equals to category. + * + * @param category the category the atteribute should be + * @param attribtue the attribute to verify + * + * @exception IllegalArgumentException if the categories are not equal + * @exception NullPointerException if category is null + */ + public static void verifyCategoryForAttribute(Class category, + Attribute attribute) + { + if (category == null) + throw new NullPointerException("object may not be null"); + + if (category.equals(attribute.getCategory())) + throw new IllegalArgumentException + ("category of attribute not equal to category"); + } +} diff --git a/libjava/javax/print/attribute/HashAttributeSet.java b/libjava/javax/print/attribute/HashAttributeSet.java new file mode 100644 index 0000000..6adf37c --- /dev/null +++ b/libjava/javax/print/attribute/HashAttributeSet.java @@ -0,0 +1,341 @@ +/* HashAttributeSet.java -- + Copyright (C) 2003 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Iterator; + +public class HashAttributeSet implements AttributeSet, Serializable +{ + private static final long serialVersionUID = 5311560590283707917L; + + private Class interfaceName; + private HashMap attributeMap = new HashMap(); + + /** + * Creates an empty HashAttributeSet object. + */ + public HashAttributeSet() + { + this(Attribute.class); + } + + /** + * Creates a HashAttributeSet object with the given + * attribute in it. + * + * @param attribute the attribute to put into the set + * + * @exception NullPointerException if attribute is null + */ + public HashAttributeSet(Attribute attribute) + { + this(attribute, Attribute.class); + } + + /** + * Creates a HashAttributeSet object with the given + * attributes in it. + * + * @param attributes the attributes to put into the set + * + * @exception NullPointerException If attributes is null + */ + public HashAttributeSet(Attribute[] attributes) + { + this(attributes, Attribute.class); + } + + /** + * Creates a HashAttributeSet object with the given + * attributes in it. + * + * @param attributes the attributes to put into the set + * + * @exception NullPointerException If attributes is null + */ + public HashAttributeSet(AttributeSet attributes) + { + this(attributes, Attribute.class); + } + + /** + * Creates an empty HashAttributeSet object. + * + * @param interfaceName the interface that all members must implement + * + * @exception NullPointerException if interfaceName is null + */ + protected HashAttributeSet(Class interfaceName) + { + if (interfaceName == null) + throw new NullPointerException("interfaceName may not be null"); + + this.interfaceName = interfaceName; + } + + /** + * Creates an empty HashAttributeSet object. + * + * @exception ClassCastException if attribute is not an interface of + * interfaceName + * @exception NullPointerException if attribute or interfaceName is null + */ + protected HashAttributeSet(Attribute attribute, Class interfaceName) + { + this(interfaceName); + + if (attribute == null) + throw new NullPointerException(); + + add(attribute); + } + + /** + * Creates an empty HashAttributeSet object. + * + * @exception ClassCastException if any element of attributes is not an + * interface of interfaceName + * @exception NullPointerException if attributes or interfaceName is null + */ + protected HashAttributeSet(Attribute[] attributes, Class interfaceName) + { + this(interfaceName); + + if (attributes == null) + throw new NullPointerException(); + + for (int index = 0; index < attributes.length; index++) + add(attributes[index]); + } + + /** + * Creates an empty HashAttributeSet object. + * + * @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); + } + + /** + * Adds the given attribute to the set. + * + * @param attribute the attribute to add + * + * @return true if the attribute set has changed, false otherwise + */ + public boolean add(Attribute attribute) + { + if (attribute == null) + throw new NullPointerException("attribute may not be null"); + + Object old = attributeMap.put + (attribute.getCategory(), AttributeSetUtilities.verifyAttributeValue + (attribute, interfaceName)); + return !attribute.equals(old); + } + + /** + * Adds the given attributes to the set. + * + * @param attributes the attributes to add + * + * @return true if the attribute set has changed, false otherwise + */ + public boolean addAll(AttributeSet attributes) + { + boolean modified = false; + Attribute[] array = attributes.toArray(); + + for (int index = 0; index < array.length; index++) + if (! add(array[index])) + modified = true; + + return modified; + } + + /** + * Removes all attributes from this attribute set. + */ + public void clear() + { + attributeMap.clear(); + } + + /** + * Checks if this attribute set contains an entry with the given category. + * + * @param category the category to test for + * + * @result true if the category exists in this attribute set, false otherwise. + */ + public boolean containsKey(Class category) + { + return attributeMap.containsKey(category); + } + + /** + * Checks if this attribute set contains an entry with the given attribute. + * + * @param attribute the attribute to test for + * + * @result true if the attribute exists in this attribute set, + * false otherwise. + */ + public boolean containsValue(Attribute attribute) + { + return attributeMap.containsValue(attribute); + } + + /** + * Tests of obj is equal to this object. + * + * @param obj the object to test + * + * @returns true if both objects are equal, false otherwise. + */ + public boolean equals(Object obj) + { + if (! (obj instanceof HashAttributeSet)) + return false; + + return attributeMap.equals(((HashAttributeSet) obj).attributeMap); + } + + /** + * Returns the attribute value that is connected to the given attribute + * category. If the attribute set does not contains the given category null + * will be returned. + * + * @param category the attribute category to return the attribute value for + * + * @return the attribute associated to category, or null + */ + public Attribute get(Class category) + { + return (Attribute) attributeMap.get(category); + } + + /** + * Returns the hashcode for this object. + * + * @return the hashcode + */ + public int hashCode() + { + return attributeMap.hashCode() + interfaceName.hashCode(); + } + + /** + * Checks if the attribute set is empty. + * + * @return true if the attribute set is empty, false otherwise + */ + public boolean isEmpty() + { + return attributeMap.isEmpty(); + } + + /** + * Removes the entry with the given attribute in it. + * + * @param attribute the attribute value of the entry to be removed + * + * @return true if the attribute set has changed, false otherwise. + */ + public boolean remove(Attribute attribute) + { + if (attribute == null) + return false; + + return attributeMap.remove(attribute.getCategory()) != null; + } + + /** + * Removes the entry with the given category in it. + * + * @param category the category value of the entry to be removed + * + * @return true if the attribute set has changed, false otherwise. + */ + public boolean remove(Class category) + { + if (category == null) + return false; + + return attributeMap.remove(category) != null; + } + + /** + * Returns the number of elements in this attribute set. + * + * @return the number of elements. + */ + public int size() + { + return attributeMap.size(); + } + + /** + * Returns the content of the attribute set as an array + * + * @return an array of attributes + */ + public Attribute[] toArray() + { + int index = 0; + Iterator it = attributeMap.entrySet().iterator(); + Attribute[] array = new Attribute[size()]; + + while (it.hasNext()) + { + array[index] = (Attribute) it.next(); + index++; + } + + return array; + } +} diff --git a/libjava/javax/print/attribute/HashDocAttributeSet.java b/libjava/javax/print/attribute/HashDocAttributeSet.java new file mode 100644 index 0000000..a7eedbf --- /dev/null +++ b/libjava/javax/print/attribute/HashDocAttributeSet.java @@ -0,0 +1,94 @@ +/* HashDocAttributeSet.java -- + Copyright (C) 2003 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +import java.io.Serializable; + +public class HashDocAttributeSet extends HashAttributeSet + implements DocAttributeSet, Serializable +{ + private static final long serialVersionUID = -1128534486061432528L; + + /** + * Creates an empty HashDocAttributeSet object. + */ + public HashDocAttributeSet() + { + super(DocAttribute.class); + } + + /** + * Creates a HashDocAttributeSet object with the given + * attribute in it. + * + * @param attribute the attriute tu put into the attribute set + * + * @exception NullPointerException if attribute is null + */ + public HashDocAttributeSet(DocAttribute attribute) + { + super(attribute, DocAttribute.class); + } + + /** + * Creates a HashDocAttributeSet object with the given + * attributes in it. + * + * @param attributes the attributes to put into the attribute set + * + * @exception NullPointerException if attributes is null + */ + public HashDocAttributeSet(DocAttribute[] attributes) + { + super(attributes, DocAttribute.class); + } + + /** + * Creates a HashDocAttributeSet object with the given + * attributes in it. + * + * @param attributes the attributes to put into the attribute set + * + * @exception ClassCastException if any element of attributes is not + * an instance of DocAttribute + */ + public HashDocAttributeSet(DocAttributeSet attributes) + { + super(attributes, DocAttribute.class); + } +} diff --git a/libjava/javax/print/attribute/HashPrintJobAttributeSet.java b/libjava/javax/print/attribute/HashPrintJobAttributeSet.java new file mode 100644 index 0000000..16b1beb --- /dev/null +++ b/libjava/javax/print/attribute/HashPrintJobAttributeSet.java @@ -0,0 +1,94 @@ +/* HashPrintJobAttributeSet.java -- + Copyright (C) 2003 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +import java.io.Serializable; + +public class HashPrintJobAttributeSet extends HashAttributeSet + implements Serializable, PrintJobAttributeSet +{ + private static final long serialVersionUID = -4204473656070350348L; + + /** + * Creates an empty HashPrintJobAttributeSet object. + */ + public HashPrintJobAttributeSet() + { + super(PrintJobAttribute.class); + } + + /** + * Creates a HashPrintJobAttributeSet object with the given + * attribute in it. + * + * @param attribute the attriute tu put into the attribute set + * + * @exception NullPointerException if attribute is null + */ + public HashPrintJobAttributeSet(PrintJobAttribute attribute) + { + super(attribute, PrintJobAttribute.class); + } + + /** + * Creates a HashPrintJobAttributeSet object with the given + * attributes in it. + * + * @param attributes the attributes to put into the attribute set + * + * @exception NullPointerException if attributes is null + */ + public HashPrintJobAttributeSet(PrintJobAttribute[] attributes) + { + super(attributes, PrintJobAttribute.class); + } + + /** + * Creates a HashPrintJobAttributeSet object with the given + * attributes in it. + * + * @param attributes the attributes to put into the attribute set + * + * @exception ClassCastException if any element of attributes is not + * an instance of PrintJobAttribute + */ + public HashPrintJobAttributeSet(PrintJobAttributeSet attributes) + { + super(attributes, PrintJobAttribute.class); + } +} diff --git a/libjava/javax/print/attribute/HashPrintRequestAttributeSet.java b/libjava/javax/print/attribute/HashPrintRequestAttributeSet.java new file mode 100644 index 0000000..2d0cbbd --- /dev/null +++ b/libjava/javax/print/attribute/HashPrintRequestAttributeSet.java @@ -0,0 +1,94 @@ +/* HashPrintRequestAttributeSet.java -- + Copyright (C) 2003 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +import java.io.Serializable; + +public class HashPrintRequestAttributeSet extends HashAttributeSet + implements Serializable, PrintRequestAttributeSet +{ + private static final long serialVersionUID = 2364756266107751933L; + + /** + * Creates an empty HashPrintRequestAttributeSet object. + */ + public HashPrintRequestAttributeSet() + { + super(PrintRequestAttribute.class); + } + + /** + * Creates a HashPrintRequestAttributeSet object with the given + * attribute in it. + * + * @param attribute the attriute tu put into the attribute set + * + * @exception NullPointerException if attribute is null + */ + public HashPrintRequestAttributeSet(PrintRequestAttribute attribute) + { + super(attribute, PrintRequestAttribute.class); + } + + /** + * Creates a HashPrintRequestAttributeSet object with the given + * attributes in it. + * + * @param attributes the attributes to put into the attribute set + * + * @exception NullPointerException if attributes is null + */ + public HashPrintRequestAttributeSet(PrintRequestAttribute[] attributes) + { + super(attributes, PrintRequestAttribute.class); + } + + /** + * Creates a HashPrintRequestAttributeSet object with the given + * attributes in it. + * + * @param attributes the attributes to put into the attribute set + * + * @exception ClassCastException if any element of attributes is not + * an instance of PrintRequestAttribute + */ + public HashPrintRequestAttributeSet(PrintRequestAttributeSet attributes) + { + super(attributes, PrintRequestAttribute.class); + } +} diff --git a/libjava/javax/print/attribute/HashPrintServiceAttributeSet.java b/libjava/javax/print/attribute/HashPrintServiceAttributeSet.java new file mode 100644 index 0000000..aa6793b --- /dev/null +++ b/libjava/javax/print/attribute/HashPrintServiceAttributeSet.java @@ -0,0 +1,94 @@ +/* HashPrintServiceAttributeSet.java -- + Copyright (C) 2003 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +import java.io.Serializable; + +public class HashPrintServiceAttributeSet extends HashAttributeSet + implements Serializable, PrintServiceAttributeSet +{ + private static final long serialVersionUID = 6642904616179203070L; + + /** + * Creates an empty HashPrintServiceAttributeSet object. + */ + public HashPrintServiceAttributeSet() + { + super(PrintServiceAttribute.class); + } + + /** + * Creates a HashPrintServiceAttributeSet object with the given + * attribute in it. + * + * @param attribute the attriute tu put into the attribute set + * + * @exception NullPointerException if attribute is null + */ + public HashPrintServiceAttributeSet(PrintServiceAttribute attribute) + { + super(attribute, PrintServiceAttribute.class); + } + + /** + * Creates a HashPrintServiceAttributeSet object with the given + * attributes in it. + * + * @param attributes the attributes to put into the attribute set + * + * @exception NullPointerException if attributes is null + */ + public HashPrintServiceAttributeSet(PrintServiceAttribute[] attributes) + { + super(attributes, PrintServiceAttribute.class); + } + + /** + * Creates a HashPrintServiceAttributeSet object with the given + * attributes in it. + * + * @param attributes the attributes to put into the attribute set + * + * @exception ClassCastException if any element of attributes is not + * an instance of PrintServiceAttribute + */ + public HashPrintServiceAttributeSet(PrintServiceAttributeSet attributes) + { + super(attributes, PrintServiceAttribute.class); + } +} -- 2.7.4