Index: ChangeLog =================================================================== RCS file: /cvsroot/classpath/classpath/ChangeLog,v retrieving revision 1.1692 diff -u -b -B -r1.1692 ChangeLog --- ChangeLog 26 Dec 2003 12:15:50 -0000 1.1692 +++ ChangeLog 26 Dec 2003 13:37:53 -0000 @@ -1,3 +1,30 @@ +2003-12-26 Michael Koch + + * 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, + javax/print/attribute/PrintRequestAttribute.java, + javax/print/attribute/PrintServiceAttribute.java, + javax/print/attribute/PrintServiceAttributeSet.java, + javax/print/attribute/ResolutionSyntax.java, + javax/print/attribute/SetOfIntegerSyntax.java, + javax/print/attribute/Size2DSyntax.java, + javax/print/attribute/SupportedValuesAttribute.java, + javax/print/attribute/TextSyntax.java, + javax/print/attribute/URISyntax.java, + javax/print/attribute/UnmodifiableSetException.java: New files + * javax/print/attribute/Makefile.am (EXTRA_DIST): Added new files. + 2003-12-26 Guilhem Lavaux Mark Wielaard Index: javax/print/attribute/AttributeSetUtilities.java =================================================================== RCS file: javax/print/attribute/AttributeSetUtilities.java diff -N javax/print/attribute/AttributeSetUtilities.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/AttributeSetUtilities.java 26 Dec 2003 13:37:53 -0000 @@ -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 verifyCategoryForValue(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"); + } +} Index: javax/print/attribute/DateTimeSyntax.java =================================================================== RCS file: javax/print/attribute/DateTimeSyntax.java diff -N javax/print/attribute/DateTimeSyntax.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/DateTimeSyntax.java 26 Dec 2003 13:37:53 -0000 @@ -0,0 +1,101 @@ +/* DateTimeSyntax.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.Date; + +/** + * @author Michael Koch + */ +public abstract class DateTimeSyntax implements Cloneable, Serializable +{ + private static final long serialVersionUID = -1400819079791208582L; + + private Date value; + + /** + * Creates a DateTimeSyntax with a given value. + * + * @param value the value for this syntax + * + * @exception NullPointerException if value is null + */ + protected DateTimeSyntax(Date value) + { + if (value == null) + throw new NullPointerException("value may not be null"); + + this.value = value; + } + + /** + * Returns the date value of this object. + * + * @return the date value + */ + public Date getValue() + { + return value; + } + + /** + * Tests if the given object is equal to this one. + * + * @param obj the object to test + * + * @return True if both objects are equal, false otherwise. + */ + public boolean equals(Object obj) + { + if (! (obj instanceof DateTimeSyntax)) + return false; + + return value.equals(((DateTimeSyntax) obj).getValue()); + } + + /** + * Returns the hashcode for this object. + * + * @return the hashcode + */ + public int hashCode() + { + return value.hashCode(); + } +} Index: javax/print/attribute/DocAttribute.java =================================================================== RCS file: javax/print/attribute/DocAttribute.java diff -N javax/print/attribute/DocAttribute.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/DocAttribute.java 26 Dec 2003 13:37:53 -0000 @@ -0,0 +1,45 @@ +/* DocAttribute.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; + +/** + * @author Michael Koch + */ +public interface DocAttribute extends Attribute +{ +} Index: javax/print/attribute/DocAttributeSet.java =================================================================== RCS file: javax/print/attribute/DocAttributeSet.java diff -N javax/print/attribute/DocAttributeSet.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/DocAttributeSet.java 26 Dec 2003 13:37:53 -0000 @@ -0,0 +1,55 @@ +/* DocAttributeSet.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; + +/** + * @author Michael Koch + */ +public interface DocAttributeSet extends AttributeSet +{ + /** + * Adds the specified attribute value to this attribute set + * if it is not already present. + */ + boolean add (Attribute attribute); + + /** + * Adds all of the elements in the specified set to this attribute. + */ + boolean addAll (AttributeSet attributes); +} Index: javax/print/attribute/EnumSyntax.java =================================================================== RCS file: javax/print/attribute/EnumSyntax.java diff -N javax/print/attribute/EnumSyntax.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/EnumSyntax.java 26 Dec 2003 13:37:53 -0000 @@ -0,0 +1,146 @@ +/* EnumSyntax.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; + +/** + * @author Michael Koch + */ +public abstract class EnumSyntax implements Cloneable, Serializable +{ + private static final long serialVersionUID = -2739521845085831642L; + + private int value; + + /** + * Creates a EnumSyntax object. + * + * @param value the value to set + */ + protected EnumSyntax(int value) + { + this.value = value; + } + + /** + * Returns the value of this object. + * + * @return the value + */ + public int getValue() + { + return value; + } + + /** + * Clones this object. + * + * @return a clone of this object + */ + public Object clone() + { + try + { + return super.clone(); + } + catch (CloneNotSupportedException e) + { + // Cannot happen as we implement java.lang.Cloneable. + return null; + } + } + + /** + * Returns the hashcode for this object. + * + * @return the hashcode + */ + public int hashCode() + { + return value; + } + + /** + * Returns the string representation for this object. + * + * @return the string representation + */ + public String toString() + { + int index = value - getOffset(); + String[] table = getStringTable(); + + if (table != null + && index >= 0 + && index < table.length) + return table[index]; + + return "" + value; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * The default implementation just returns null. + * + * @return the enumeration values as strings + */ + public String[] getStringTable() + { + return null; + } + + /** + * Returns a table with the enumeration values for this object. + * + * The default implementation just returns null. + * + * @return the enumeration values + */ + public EnumSyntax[] getEnumValueTable() + { + return null; + } + + public int getOffset() + { + return 0; + } +} Index: javax/print/attribute/HashAttributeSet.java =================================================================== RCS file: javax/print/attribute/HashAttributeSet.java diff -N javax/print/attribute/HashAttributeSet.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/HashAttributeSet.java 26 Dec 2003 13:37:53 -0000 @@ -0,0 +1,366 @@ +/* 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(); + + addInternal(attribute, interfaceName); + } + + /** + * 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++) + addInternal(attributes[index], interfaceName); + } + + /** + * Creates an empty HashAttributeSet object. + * + * @exception ClassCastException if any element of attributes is not an + * interface of interfaceName + */ + public HashAttributeSet(AttributeSet attributes, Class interfaceName) + { + this(interfaceName); + + if (attributes != null) + addAllInternal(attributes, interfaceName); + } + + /** + * Adds the given attribute to the set. + * + * @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)); + 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 + * + * @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 (addInternal(array[index], interfaceName)) + modified = true; + + return modified; + } + + /** + * Removes all attributes from this attribute set. + * + * @exception UnmodifiableSetException if this attribute set does not + * support this action. + */ + 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. + * + * @exception UnmodifiableSetException if this attribute set does not + * support this action. + */ + 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; + } +} Index: javax/print/attribute/HashDocAttributeSet.java =================================================================== RCS file: javax/print/attribute/HashDocAttributeSet.java diff -N javax/print/attribute/HashDocAttributeSet.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/HashDocAttributeSet.java 26 Dec 2003 13:37:53 -0000 @@ -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); + } +} Index: javax/print/attribute/HashPrintJobAttributeSet.java =================================================================== RCS file: javax/print/attribute/HashPrintJobAttributeSet.java diff -N javax/print/attribute/HashPrintJobAttributeSet.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/HashPrintJobAttributeSet.java 26 Dec 2003 13:37:53 -0000 @@ -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); + } +} Index: javax/print/attribute/HashPrintRequestAttributeSet.java =================================================================== RCS file: javax/print/attribute/HashPrintRequestAttributeSet.java diff -N javax/print/attribute/HashPrintRequestAttributeSet.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/HashPrintRequestAttributeSet.java 26 Dec 2003 13:37:53 -0000 @@ -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); + } +} Index: javax/print/attribute/HashPrintServiceAttributeSet.java =================================================================== RCS file: javax/print/attribute/HashPrintServiceAttributeSet.java diff -N javax/print/attribute/HashPrintServiceAttributeSet.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/HashPrintServiceAttributeSet.java 26 Dec 2003 13:37:53 -0000 @@ -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); + } +} Index: javax/print/attribute/IntegerSyntax.java =================================================================== RCS file: javax/print/attribute/IntegerSyntax.java diff -N javax/print/attribute/IntegerSyntax.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/IntegerSyntax.java 26 Dec 2003 13:37:53 -0000 @@ -0,0 +1,122 @@ +/* IntegerSyntax.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; + +/** + * @author Michael Koch + */ +public abstract class IntegerSyntax implements Cloneable, Serializable +{ + private int value; + + /** + * Creates a IntegerSyntax with the given value. + * + * @param value the value to set + */ + protected IntegerSyntax(int value) + { + this.value = value; + } + + /** + * Creates a IntegerSyntax with the given arguments. + * + * @param value the value to set + * @param lowerBound the lower bound for the value + * @param upperBound the upper bound for the value + * + * @exception IllegalArgumentException if value < lowerBound + * or value > upperBound + */ + protected IntegerSyntax(int value, int lowerBound, int upperBound) + { + if (value < lowerBound + || value > upperBound) + throw new IllegalArgumentException("value not in range"); + + this.value = value; + } + + /** + * Returns the value of this object. + * + * @return the value + */ + public int getValue() + { + return value; + } + + /** + * 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 IntegerSyntax)) + return false; + + return value == ((IntegerSyntax) obj).getValue(); + } + + /** + * Returns the hashcode for this object. + * + * @return the hashcode + */ + public int hashCode() + { + return value; + } + + /** + * Returns the string representation for this object. + * + * @return the string representation + */ + public String toString() + { + return "" + value; + } +} Index: javax/print/attribute/PrintJobAttribute.java =================================================================== RCS file: javax/print/attribute/PrintJobAttribute.java diff -N javax/print/attribute/PrintJobAttribute.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/PrintJobAttribute.java 26 Dec 2003 13:37:53 -0000 @@ -0,0 +1,45 @@ +/* PrintJobAttribute.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; + +/** + * @author Michael Koch + */ +public interface PrintJobAttribute extends Attribute +{ +} Index: javax/print/attribute/PrintJobAttributeSet.java =================================================================== RCS file: javax/print/attribute/PrintJobAttributeSet.java diff -N javax/print/attribute/PrintJobAttributeSet.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/PrintJobAttributeSet.java 26 Dec 2003 13:37:53 -0000 @@ -0,0 +1,55 @@ +/* PrintJobAttributeSet.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; + +/** + * @author Michael Koch + */ +public interface PrintJobAttributeSet extends AttributeSet +{ + /** + * Adds the specified attribute value to this attribute set + * if it is not already present. + */ + boolean add (Attribute attribute); + + /** + * Adds all of the elements in the specified set to this attribute. + */ + boolean addAll (AttributeSet attributes); +} Index: javax/print/attribute/PrintRequestAttribute.java =================================================================== RCS file: javax/print/attribute/PrintRequestAttribute.java diff -N javax/print/attribute/PrintRequestAttribute.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/PrintRequestAttribute.java 26 Dec 2003 13:37:53 -0000 @@ -0,0 +1,45 @@ +/* PrintRequestAttribute.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; + +/** + * @author Michael Koch + */ +public interface PrintRequestAttribute extends Attribute +{ +} Index: javax/print/attribute/PrintServiceAttribute.java =================================================================== RCS file: javax/print/attribute/PrintServiceAttribute.java diff -N javax/print/attribute/PrintServiceAttribute.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/PrintServiceAttribute.java 26 Dec 2003 13:37:53 -0000 @@ -0,0 +1,45 @@ +/* PrintServiceAttribute.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; + +/** + * @author Michael Koch + */ +public interface PrintServiceAttribute extends Attribute +{ +} Index: javax/print/attribute/PrintServiceAttributeSet.java =================================================================== RCS file: javax/print/attribute/PrintServiceAttributeSet.java diff -N javax/print/attribute/PrintServiceAttributeSet.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/PrintServiceAttributeSet.java 26 Dec 2003 13:37:53 -0000 @@ -0,0 +1,55 @@ +/* PrintServiceAttributeSet.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; + +/** + * @author Michael Koch + */ +public interface PrintServiceAttributeSet extends AttributeSet +{ + /** + * Adds the specified attribute value to this attribute set + * if it is not already present. + */ + boolean add (Attribute attribute); + + /** + * Adds all of the elements in the specified set to this attribute. + */ + boolean addAll (AttributeSet attributes); +} Index: javax/print/attribute/ResolutionSyntax.java =================================================================== RCS file: javax/print/attribute/ResolutionSyntax.java diff -N javax/print/attribute/ResolutionSyntax.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/ResolutionSyntax.java 26 Dec 2003 13:37:53 -0000 @@ -0,0 +1,220 @@ +/* ResolutionSyntax.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; + +/** + * @author Michael Koch + */ +public abstract class ResolutionSyntax + implements Cloneable, Serializable +{ + private static final long serialVersionUID = 2706743076526672017L; + + /** + * Constant for units of dots per centimeter. + */ + public static final int DPCM = 254; + + /** + * Constant for units of dots per inch + */ + public static final int DPI = 100; + + private int crossFeedResolution; + private int feedResolution; + + /** + * Creates a ResolutionSyntax object with the given arguments. + * + * @param crossFeedResolution the cross feed resolution + * @param feedResolution the feed resolution + * @param units the unit to use + * + * @exception IllegalArgumentException if preconditions fail + */ + public ResolutionSyntax(int crossFeedResolution, int feedResolution, + int units) + { + if (crossFeedResolution < 1 + || feedResolution < 1 + || units < 1) + throw new IllegalArgumentException("no argument may be less than 1"); + + this.crossFeedResolution = crossFeedResolution * units; + this.feedResolution = feedResolution * units; + } + + /** + * 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 ResolutionSyntax)) + return false; + + ResolutionSyntax tmp = (ResolutionSyntax) obj; + + return (crossFeedResolution == tmp.getCrossFeedResolutionDphi() + && feedResolution == tmp.getFeedResolutionDphi()); + } + + /** + * Returns the cross feed resolution in units. + * + * @return the resolution + * + * @exception IllegalArgumenException if units < 1 + */ + public int getCrossFeedResolution(int units) + { + if (units < 1) + throw new IllegalArgumentException("units may not be less then 1"); + + int rount = units / 2; + return (crossFeedResolution + units) / units; + } + + /** + * Returns the raw cross feed resolution in units. + * + * @return the raw resolution + */ + protected int getCrossFeedResolutionDphi() + { + return crossFeedResolution; + } + + /** + * Returns the feed resolution in units. + * + * @return the resolution + * + * @exception IllegalArgumenException if units < 1 + */ + public int getFeedResolution(int units) + { + if (units < 1) + throw new IllegalArgumentException("units may not be less then 1"); + + int rount = units / 2; + return (crossFeedResolution + units) / units; + } + + /** + * Returns the raw feed resolution in units. + * + * @return the raw resolution + */ + protected int getFeedResolutionDphi() + { + return feedResolution; + } + + /** + * Returns the resolution as two field array. Index 0 is the cross feed + * resolution, index 1 the feed resolution. + * + * @param units the units to use + * + * @return the array with the resolutions + */ + public int[] getResolution(int units) + { + int[] resolution = new int[2]; + resolution[0] = getCrossFeedResolution(units); + resolution[1] = getFeedResolution(units); + return resolution; + } + + /** + * Returns the hashcode for this object. + * + * @return the hashcode + */ + public int hashCode() + { + return crossFeedResolution + feedResolution; + } + + /** + * Checks of other is a lower or equal resolution. + * + * @param other the resolution to check against + * + * @return true if other describes a lower or equal resolution + */ + public boolean lessThanOrEquals(ResolutionSyntax other) + { + if (other == null) + throw new NullPointerException("other may not be null"); + + return (crossFeedResolution <= other.getCrossFeedResolutionDphi() + && feedResolution <= other.getFeedResolutionDphi()); + } + + /** + * Returns the string representation for this object. + * + * @return the string representation + */ + public String toString() + { + return toString(1, "dphi"); + } + + /** + * Returns the string representation for this object. + * + * @param units the units to use + * @param unitsName the name of the units + * + * @return the string representation + */ + public String toString(int units, String unitsName) + { + return ("" + getCrossFeedResolution(units) + + "x" + getFeedResolution(units) + + " " + unitsName); + } +} Index: javax/print/attribute/SetOfIntegerSyntax.java =================================================================== RCS file: javax/print/attribute/SetOfIntegerSyntax.java diff -N javax/print/attribute/SetOfIntegerSyntax.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/SetOfIntegerSyntax.java 26 Dec 2003 13:37:53 -0000 @@ -0,0 +1,253 @@ +/* SetOfIntegerSyntax.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.Vector; + +/** + * @author Michael Koch + */ +public abstract class SetOfIntegerSyntax + implements Cloneable, Serializable +{ + private static final long serialVersionUID = 3666874174847632203L; + + private int[][] members; + + private static int[][] normalize(Vector vecMembers) + { + // XXX: Perhaps we should merge ranges that overlap. + + int current = 0; + int[][] members = new int[vecMembers.size()][]; + + while (vecMembers.size() > 0) + { + // Search the lowest range. + int[] range = (int[]) vecMembers.elementAt(0); + + for (int index = 1; index < vecMembers.size(); index++) + { + int[] tmp = (int[]) vecMembers.elementAt(index); + + if (range[0] > tmp[0] + || (range[0] == tmp[0] + && range[0] > tmp[0])) + range = tmp; + } + + members[current] = range; + current++; + } + + return members; + } + + /** + * Creates a SetOfIntegerSyntax object. + * + * @param member the member value + * + * @exception IllegalArgumentException if member is < 0 + */ + protected SetOfIntegerSyntax(int member) + { + if (member < 0) + throw new IllegalArgumentException("member may not be less than 0"); + + this.members = new int[][]{{member, member}}; + } + + /** + * Creates a SetOfIntegerSyntax object. + * + * @param members the members to use in this set + * + * @exception IllegalArgumentException if any element is invalid + * @exception NullPointerException if any element of members is null + */ + protected SetOfIntegerSyntax(int[][] members) + { + Vector vecMembers = new Vector(); + + if (members != null) + { + for (int index = 0; index < members.length; index++) + { + int lower; + int upper; + + if (members[index].length == 1) + { + lower = members[index][0]; + upper = members[index][0]; + } + else if (members[index].length == 2) + { + lower = members[index][0]; + upper = members[index][1]; + } + else + throw new IllegalArgumentException("invalid member element"); + + if (lower <= upper && lower < 0) + throw new IllegalArgumentException("invalid member element"); + + if (lower <= upper) + { + int[] range = new int[2]; + range[0] = lower; + range[1] = upper; + vecMembers.add(range); + } + } + } + + this.members = normalize(vecMembers); + } + + /** + * Creates a SetOfIntegerSyntax object. + * + * @param lowerBound the lower bound value + * @param upperBound the upper bound value + * + * @exception IllegalArgumentException if lowerBound <= uppbound + * and lowerBound < 0 + */ + protected SetOfIntegerSyntax(int lowerBound, int upperBound) + { + if (lowerBound <= upperBound + && lowerBound < 0) + throw new IllegalArgumentException(); + + members = (lowerBound <= upperBound ? new int[][]{{lowerBound, upperBound}} + : new int[0][]); + } + + /** + * Checks if this set contains value. + * + * @param value the value to test for + * + * @return true if this set contains value, false otherwise + */ + public boolean contains(int value) + { + // This only works on a normalized member array. + for (int index = 0; index < members.length; index++) + { + if (value < members[index][0]) + return false; + else if (value < members[index][1]) + return true; + } + + return false; + } + + /** + * Checks if this set contains value. + * + * @param value the value to test for + * + * @return true if this set contains value, false otherwise + */ + public boolean contains(IntegerSyntax value) + { + return contains(value.getValue()); + } + + /** + * 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 SetOfIntegerSyntax)) + return false; + + throw new Error("not implemented"); + } + + /** + * Returns an array describing the members included in this set. + * + * @return the array with the members + */ + public int[][] getMembers() + { + throw new Error("not implemented"); + } + + /** + * Returns the hashcode for this object. + * + * @return the hashcode + */ + public int hashCode() + { + throw new Error("not implemented"); + } + + /** + * Returns the smallest value that is greater then x. + * + * @param x an integer value + * + * @return the next value + */ + public int next(int x) + { + throw new Error("not implemented"); + } + + /** + * Returns the string representation for this object. + * + * @return the string representation + */ + public String toString() + { + throw new Error("not implemented"); + } +} Index: javax/print/attribute/Size2DSyntax.java =================================================================== RCS file: javax/print/attribute/Size2DSyntax.java diff -N javax/print/attribute/Size2DSyntax.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/Size2DSyntax.java 26 Dec 2003 13:37:53 -0000 @@ -0,0 +1,225 @@ +/* Size2DSyntax.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; + +/** + * @author Michael Koch + */ +public abstract class Size2DSyntax implements Cloneable, Serializable +{ + /** + * Constant for units of dots per mircometer to describe an inch. + */ + public static final int INCH = 25400; + + /** + * Constant for units of dots per mircometer to describe a centimeter. + */ + public static final int MM = 1000; + + private int x; + private int y; + + /** + * Creates a Size2DSyntax object with the given arguments. + * + * @param x the size in x direction + * @param y the size in y direction + * @param units the units to use for the sizes + * + * @exception IllegalArgumentException if preconditions fail + */ + protected Size2DSyntax(float x, float y, int units) + { + if (x < 0.0f || y < 0.0f) + throw new IllegalArgumentException("x and/or y may not be less than 0"); + + if (units < 1) + throw new IllegalArgumentException("units may not be less then 1"); + + this.x = (int) (x * units + 0.5f); + this.y = (int) (y * units + 0.5f); + } + + /** + * Creates a Size2DSyntax object with the given arguments. + * + * @param x the size in x direction + * @param y the size in y direction + * @param units the units to use for the sizes + * + * @exception IllegalArgumentException if preconditions fail + */ + protected Size2DSyntax(int x, int y, int units) + { + if (x < 0 || y < 0) + throw new IllegalArgumentException("x and/or y may not be less then 0"); + + if (units < 1) + throw new IllegalArgumentException("units may not be less then 1"); + + this.x = x * units; + this.y = y * units; + } + + /** + * 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 Size2DSyntax)) + return false; + + Size2DSyntax tmp = (Size2DSyntax) obj; + + return (x == tmp.getXMicrometers() + && y == tmp.getYMicrometers()); + } + + /** + * Return the size described in this object as a two field array. + * Index 0 contains the size in x direction, index 1 the size in + * y direction. + * + * @param units the units to use + * + * @return the array that describes the size + * + * @exception IllegalArgumentException if units < 1 + */ + public float[] getSize(int units) + { + float[] size = new float[2]; + size[0] = getX(units); + size[1] = getY(units); + return size; + } + + /** + * Return the size in x direction. + * + * @param units the units to use + * + * @return the size value + * + * @exception IllegalArgumentException if units < 1 + */ + public float getX(int units) + { + if (units < 1) + throw new IllegalArgumentException("units may not be less then 1"); + + return ((float) x) / ((float) units); + } + + /** + * Returns the size in x direction in mircometers. + * + * @return the size value + */ + protected int getXMicrometers() + { + return x; + } + + /** + * Return the size in y direction. + * + * @param units the units to use + * + * @return the size value + * + * @exception IllegalArgumentException if units < 1 + */ + public float getY(int units) + { + if (units < 1) + throw new IllegalArgumentException("units may not be less then 1"); + + return ((float) y) / ((float) units); + } + + /** + * Returns the size in y direction in mircometers. + * + * @return the size value + */ + protected int getYMicrometers() + { + return y; + } + + /** + * Returns the hashcode for this object. + * + * @return the hashcode + */ + public int hashCode() + { + return x + y; + } + + /** + * Returns the string representation for this object. + * + * @return the string representation + */ + public String toString() + { + return toString(1, "um"); + } + + /** + * Returns the string representation for this object. + * + * @param units the units to use + * @param unitsName the name of the units + * + * @return the string representation + */ + public String toString(int units, String unitsName) + { + return "" + getX(units) + "x" + getY(units) + " " + unitsName; + } +} Index: javax/print/attribute/SupportedValuesAttribute.java =================================================================== RCS file: javax/print/attribute/SupportedValuesAttribute.java diff -N javax/print/attribute/SupportedValuesAttribute.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/SupportedValuesAttribute.java 26 Dec 2003 13:37:53 -0000 @@ -0,0 +1,45 @@ +/* Attribute.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; + +/** + * @author Michael Koch + */ +public interface SupportedValuesAttribute extends Attribute +{ +} Index: javax/print/attribute/TextSyntax.java =================================================================== RCS file: javax/print/attribute/TextSyntax.java diff -N javax/print/attribute/TextSyntax.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/TextSyntax.java 26 Dec 2003 13:37:53 -0000 @@ -0,0 +1,118 @@ +/* TextSyntax.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.Locale; + +/** + * @author Michael Koch + */ +public abstract class TextSyntax implements Cloneable, Serializable +{ + private static final long serialVersionUID = -8130648736378144102L; + + private String value; + private Locale locale; + + /** + * Creates a TextSyntax object with the given value + * and locale. + * + * @param value the value for this syntax + * @param locale the locale to use + * + * @exception NullPointerException if value is null + */ + protected TextSyntax(String value, Locale locale) + { + if (value == null) + throw new NullPointerException("value may not be null"); + + this.value = value; + this.locale = locale; + } + + /** + * Returns the value of this syntax object. + * + * @return the value + */ + public String getValue() + { + return value; + } + + /** + * Returns the locale of this syntax object. + * + * @return the locale + */ + public Locale getLocale() + { + return locale; + } + + /** + * Returns the hashcode for this object. + * + * @return the hashcode + */ + public int hashCode() + { + return value.hashCode() + locale.hashCode(); + } + + /** + * 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 TextSyntax)) + return false; + + TextSyntax tmp = (TextSyntax) obj; + + return (value.equals(tmp.getValue()) + && locale.equals(tmp.getLocale())); + } +} Index: javax/print/attribute/URISyntax.java =================================================================== RCS file: javax/print/attribute/URISyntax.java diff -N javax/print/attribute/URISyntax.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/URISyntax.java 26 Dec 2003 13:37:53 -0000 @@ -0,0 +1,112 @@ +/* URISyntax.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.net.URI; + +/** + * @author Michael Koch + */ +public abstract class URISyntax + implements Cloneable, Serializable +{ + private static final long serialVersionUID = -7842661210486401678L; + + private URI uri; + + /** + * Creates a URISyntax object. + * + * @param uri the URI value for the syntax + * + * @exception NullPointerException if uri is null + */ + protected URISyntax(URI uri) + { + if (uri == null) + throw new NullPointerException("uri may not be null"); + + this.uri = uri; + } + + /** + * 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 URISyntax)) + return false; + + return uri.equals(((URISyntax) obj).getURI()); + } + + /** + * Returns the URI value of this syntax object. + * + * @return the URI + */ + public URI getURI() + { + return uri; + } + + /** + * Returns the hashcode for this object. + * + * @return the hashcode + */ + public int hashCode() + { + return uri.hashCode(); + } + + /** + * Returns the string representation for this object. + * + * @return the string representation + */ + public String toString() + { + return uri.toString(); + } +} Index: javax/print/attribute/UnmodifiableSetException.java =================================================================== RCS file: javax/print/attribute/UnmodifiableSetException.java diff -N javax/print/attribute/UnmodifiableSetException.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javax/print/attribute/UnmodifiableSetException.java 26 Dec 2003 13:37:53 -0000 @@ -0,0 +1,65 @@ +/* Attribute.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; + +/** + * @author Michael Koch + * + * @since 1.4 + */ +public class UnmodifiableSetException extends RuntimeException +{ + /** + * Creates a UnmodifiableSetException. + */ + public UnmodifiableSetException() + { + super(); + } + + /** + * Creates a UnmodifiableSetException + * with the given message. + * + * @param message the message for the exception + */ + public UnmodifiableSetException(String message) + { + super(message); + } +} Index: javax/print/attribute/Makefile.am =================================================================== RCS file: /cvsroot/classpath/classpath/javax/print/attribute/Makefile.am,v retrieving revision 1.1 diff -u -b -B -r1.1 Makefile.am --- javax/print/attribute/Makefile.am 29 Apr 2003 09:44:33 -0000 1.1 +++ javax/print/attribute/Makefile.am 26 Dec 2003 13:37:53 -0000 @@ -3,4 +3,28 @@ EXTRA_DIST = \ Attribute.java \ AttributeSet.java \ +AttributeSetUtilities.java \ +DateTimeSyntax.java \ +DocAttribute.java \ +DocAttributeSet.java \ +EnumSyntax.java \ +HashAttributeSet.java \ +HashDocAttributeSet.java \ +HashPrintJobAttributeSet.java \ +HashPrintRequestAttributeSet.java \ +HashPrintServiceAttributeSet.java \ +IntegerSyntax.java \ +PrintJobAttribute.java \ +PrintJobAttributeSet.java \ +PrintRequestAttribute.java \ +PrintRequestAttributeSet.java \ +PrintServiceAttribute.java \ +PrintServiceAttributeSet.java \ +ResolutionSyntax.java \ +SetOfIntegerSyntax.java \ +Size2DSyntax.java \ +SupportedValuesAttribute.java \ +TextSyntax.java \ +UnmodifiableSetException.java \ +URISyntax.java \ package.html