aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/javax/print/attribute
diff options
context:
space:
mode:
authorMark Wielaard <mark@gcc.gnu.org>2005-11-15 23:20:01 +0000
committerMark Wielaard <mark@gcc.gnu.org>2005-11-15 23:20:01 +0000
commit8f523f3a1047919d3563daf1ef47ba87336ebe89 (patch)
treea5eb7cf42a51869cc8aa1fad7ad6a90cca47fdd8 /libjava/classpath/javax/print/attribute
parent02e549bfaaec38f68307e7f34e46ea57ea1809af (diff)
downloadgcc-8f523f3a1047919d3563daf1ef47ba87336ebe89.zip
gcc-8f523f3a1047919d3563daf1ef47ba87336ebe89.tar.gz
gcc-8f523f3a1047919d3563daf1ef47ba87336ebe89.tar.bz2
Imported GNU Classpath 0.19 + gcj-import-20051115.
* sources.am: Regenerated. * Makefile.in: Likewise. * scripts/makemake.tcl: Use glob -nocomplain. From-SVN: r107049
Diffstat (limited to 'libjava/classpath/javax/print/attribute')
-rw-r--r--libjava/classpath/javax/print/attribute/Attribute.java20
-rw-r--r--libjava/classpath/javax/print/attribute/AttributeSet.java147
-rw-r--r--libjava/classpath/javax/print/attribute/AttributeSetUtilities.java87
-rw-r--r--libjava/classpath/javax/print/attribute/DateTimeSyntax.java16
-rw-r--r--libjava/classpath/javax/print/attribute/DocAttribute.java19
-rw-r--r--libjava/classpath/javax/print/attribute/DocAttributeSet.java35
-rw-r--r--libjava/classpath/javax/print/attribute/EnumSyntax.java122
-rw-r--r--libjava/classpath/javax/print/attribute/HashAttributeSet.java190
-rw-r--r--libjava/classpath/javax/print/attribute/HashDocAttributeSet.java22
-rw-r--r--libjava/classpath/javax/print/attribute/HashPrintJobAttributeSet.java22
-rw-r--r--libjava/classpath/javax/print/attribute/HashPrintRequestAttributeSet.java22
-rw-r--r--libjava/classpath/javax/print/attribute/HashPrintServiceAttributeSet.java22
-rw-r--r--libjava/classpath/javax/print/attribute/IntegerSyntax.java25
-rw-r--r--libjava/classpath/javax/print/attribute/PrintJobAttribute.java19
-rw-r--r--libjava/classpath/javax/print/attribute/PrintJobAttributeSet.java35
-rw-r--r--libjava/classpath/javax/print/attribute/PrintRequestAttribute.java14
-rw-r--r--libjava/classpath/javax/print/attribute/PrintRequestAttributeSet.java35
-rw-r--r--libjava/classpath/javax/print/attribute/PrintServiceAttribute.java19
-rw-r--r--libjava/classpath/javax/print/attribute/PrintServiceAttributeSet.java35
-rw-r--r--libjava/classpath/javax/print/attribute/SetOfIntegerSyntax.java186
-rw-r--r--libjava/classpath/javax/print/attribute/SupportedValuesAttribute.java20
-rw-r--r--libjava/classpath/javax/print/attribute/URISyntax.java18
-rw-r--r--libjava/classpath/javax/print/attribute/UnmodifiableSetException.java12
-rw-r--r--libjava/classpath/javax/print/attribute/package.html9
24 files changed, 898 insertions, 253 deletions
diff --git a/libjava/classpath/javax/print/attribute/Attribute.java b/libjava/classpath/javax/print/attribute/Attribute.java
index fcaa7d8..7ce0247 100644
--- a/libjava/classpath/javax/print/attribute/Attribute.java
+++ b/libjava/classpath/javax/print/attribute/Attribute.java
@@ -1,5 +1,5 @@
/* Attribute.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,11 +40,27 @@ package javax.print.attribute;
import java.io.Serializable;
/**
- * @author Michael Koch
+ * Base interface of every printing attribute of the Java Print Service API.
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface Attribute extends Serializable
{
+ /**
+ * Returns the category of the printing attribute which is the specific
+ * attribute class implementing this interface.
+ *
+ * @return The concrete {@link Class} instance of the attribute class.
+ */
Class getCategory ();
+ /**
+ * Returns the descriptive name of the attribute category.
+ *
+ * Implementations of the <code>Attribute</code> interfaces providing equal
+ * category values have to return equal name values.
+ *
+ * @return The name of the attribute category.
+ */
String getName ();
}
diff --git a/libjava/classpath/javax/print/attribute/AttributeSet.java b/libjava/classpath/javax/print/attribute/AttributeSet.java
index cdc7a8e..b4bdeca 100644
--- a/libjava/classpath/javax/print/attribute/AttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/AttributeSet.java
@@ -1,5 +1,5 @@
/* AttributeSet.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,40 +38,159 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * <code>AttributeSet</code> is the top-level interface for sets of printing
+ * attributes in the Java Print Service API.
+ * <p>
+ * There are no duplicate values allowed in an attribute set and there is
+ * at most one attribute object contained per category type. Based on the
+ * {@link java.util.Map} interface the values of attribute sets are objects
+ * of type {@link javax.print.attribute.Attribute} and the entries are the
+ * categories as {@link java.lang.Class} instances.
+ * </p>
+ * <p>
+ * The following specialized types of <code>AttributeSet</code> are available:
+ * <ul>
+ * <li>{@link javax.print.attribute.DocAttributeSet}</li>
+ * <li>{@link javax.print.attribute.PrintRequestAttributeSet}</li>
+ * <li>{@link javax.print.attribute.PrintJobAttributeSet}</li>
+ * <li>{@link javax.print.attribute.PrintServiceAttributeSet}</li>
+ * </ul>
+ * </p>
+ * <p>
+ * Attribute sets may be unmodifiable depending on the context of usage. If
+ * used as read-only attribute set modifying operations throw an
+ * {@link javax.print.attribute.UnmodifiableSetException}.
+ * </p>
+ * <p>
+ * The Java Print Service API provides implementation classes for the existing
+ * attribute set interfaces but applications may use their own implementations.
+ * </p>
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface AttributeSet
{
/**
- * Adds the specified attribute value to this attribute set
+ * Adds the specified attribute value to this attribute set
* if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute to the set.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
boolean add (Attribute attribute);
/**
- * Adds all of the elements in the specified set to this attribute.
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
*/
boolean addAll (AttributeSet attributes);
-
+
+ /**
+ * Removes all attributes from this attribute set.
+ *
+ * @throws UnmodifiableSetException if the set does not support modification.
+ */
void clear ();
-
+
+ /**
+ * Checks if this attributes set contains an attribute with the given
+ * category.
+ *
+ * @param category the category to test for.
+ * @return <code>true</code> if an attribute of the category is contained
+ * in the set, <code>false</code> otherwise.
+ */
boolean containsKey (Class category);
-
+
+ /**
+ * Checks if this attribute set contains the given attribute.
+ *
+ * @param attribute the attribute to test for.
+ * @return <code>true</code> if the attribute is contained in the set,
+ * <code>false</code> otherwise.
+ */
boolean containsValue (Attribute attribute);
+ /**
+ * Tests this set for equality with the given object. <code>true</code> is
+ * returned, if the given object is also of type <code>AttributeSet</code>
+ * and the contained attributes are the same as in this set.
+ *
+ * @param obj the Object to test.
+ * @return <code>true</code> if equal, false otherwise.
+ */
boolean equals (Object obj);
-
- Attribute get (Class Category);
-
+
+ /**
+ * Returns the attribute object contained in this set for the given attribute
+ * category.
+ *
+ * @param category the category of the attribute. A <code>Class</code>
+ * instance of a class implementing the <code>Attribute</code> interface.
+ * @return The attribute for this category or <code>null</code> if no
+ * attribute is contained for the given category.
+ * @throws NullPointerException if category is null.
+ * @throws ClassCastException if category is not implementing
+ * <code>Attribute</code>.
+ */
+ Attribute get (Class category);
+
+ /**
+ * Returns the hashcode value. The hashcode value is the sum of all hashcodes
+ * of the attributes contained in this set.
+ *
+ * @return The hashcode for this attribute set.
+ */
int hashCode ();
-
+
+ /**
+ * Checks if the attribute set is empty.
+ *
+ * @return <code>true</code> if the attribute set is empty, false otherwise.
+ */
boolean isEmpty ();
+ /**
+ * Removes the given attribute from the set. If the given attribute is <code>null</code>
+ * nothing is done and <code>false</code> is returned.
+ *
+ * @param attribute the attribute to remove.
+ * @return <code>true</code> if removed, false in all other cases.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ */
boolean remove (Attribute attribute);
-
+
+ /**
+ * Removes the attribute entry of the given category from the set. If the given
+ * category is <code>null</code> nothing is done and <code>false</code> is returned.
+ *
+ * @param category the category of the entry to be removed.
+ * @return <code>true</code> if an attribute is removed, false in all other cases.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ */
boolean remove (Class category);
-
+
+ /**
+ * Returns the number of elements in this attribute set.
+ *
+ * @return The number of elements.
+ */
int size ();
-
+
+ /**
+ * Returns the content of the attribute set as an array
+ *
+ * @return An array of attributes.
+ */
Attribute[] toArray ();
}
diff --git a/libjava/classpath/javax/print/attribute/AttributeSetUtilities.java b/libjava/classpath/javax/print/attribute/AttributeSetUtilities.java
index 6f0ffc1..5d97c66 100644
--- a/libjava/classpath/javax/print/attribute/AttributeSetUtilities.java
+++ b/libjava/classpath/javax/print/attribute/AttributeSetUtilities.java
@@ -39,12 +39,41 @@ package javax.print.attribute;
import java.io.Serializable;
+/**
+ * <code>AttributeSetUtilities</code> provides static methods for working
+ * with <code>AttributeSet</code>s.
+ * <p>
+ * For every type of an attribute set available in the Java Print Service API
+ * are methods provided to get an unmodifiable view of an attribute set.
+ * This unmodifiable view provides a read-only version of the attribute
+ * set which throws {@link javax.print.attribute.UnmodifiableSetException}s
+ * if state changing methods are invoked.
+ * </p>
+ * <p>
+ * Methods for getting a synchronized view of an attribute set are also
+ * available. This view provides synchronized (thread safe) access to the
+ * underlying wrapped attribute set.
+ * </P>
+ * <p>
+ * Three static methods for the implementation of own AttributeSets
+ * are provided, which verify that:
+ * <ul>
+ * <li>the given object is an attribute of the given interface.</li>
+ * <li>the category of given attribute is equals to a given category.</li>
+ * <li>the given object is a <code>Class</code> that implements the given
+ * interface name.</li>
+ * </ul>
+ *
+ */
public final class AttributeSetUtilities
{
/**
* This class isn't intended to be instantiated.
*/
- private AttributeSetUtilities() {}
+ private AttributeSetUtilities()
+ {
+ // only static methods
+ }
private static class UnmodifiableAttributeSet
implements AttributeSet, Serializable
@@ -287,7 +316,8 @@ public final class AttributeSetUtilities
/**
* Returns a synchronized view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to synchronize.
+ * @return The sychronized attribute set.
*/
public static AttributeSet synchronizedView(AttributeSet attributeSet)
{
@@ -297,7 +327,8 @@ public final class AttributeSetUtilities
/**
* Returns a synchronized view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to synchronize.
+ * @return The sychronized attribute set.
*/
public static DocAttributeSet synchronizedView(DocAttributeSet attributeSet)
{
@@ -307,7 +338,8 @@ public final class AttributeSetUtilities
/**
* Returns a synchronized view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to synchronize.
+ * @return The sychronized attribute set.
*/
public static PrintJobAttributeSet synchronizedView(PrintJobAttributeSet attributeSet)
{
@@ -317,7 +349,8 @@ public final class AttributeSetUtilities
/**
* Returns a synchronized view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to synchronize.
+ * @return The sychronized attribute set.
*/
public static PrintRequestAttributeSet synchronizedView(PrintRequestAttributeSet attributeSet)
{
@@ -327,7 +360,8 @@ public final class AttributeSetUtilities
/**
* Returns a synchronized view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to synchronize.
+ * @return The sychronized attribute set.
*/
public static PrintServiceAttributeSet synchronizedView(PrintServiceAttributeSet attributeSet)
{
@@ -337,7 +371,8 @@ public final class AttributeSetUtilities
/**
* Returns an unmodifiable view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to make unmodifiable.
+ * @return The unmodifiable attribute set.
*/
public static AttributeSet unmodifiableView(AttributeSet attributeSet)
{
@@ -347,7 +382,8 @@ public final class AttributeSetUtilities
/**
* Returns an unmodifiable view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to make unmodifiable.
+ * @return The unmodifiable attribute set.
*/
public static DocAttributeSet unmodifiableView(DocAttributeSet attributeSet)
{
@@ -357,7 +393,8 @@ public final class AttributeSetUtilities
/**
* Returns an unmodifiable view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to make unmodifiable.
+ * @return The unmodifiable attribute set.
*/
public static PrintJobAttributeSet unmodifiableView(PrintJobAttributeSet attributeSet)
{
@@ -367,7 +404,8 @@ public final class AttributeSetUtilities
/**
* Returns an unmodifiable view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to make unmodifiable.
+ * @return The unmodifiable attribute set.
*/
public static PrintRequestAttributeSet unmodifiableView(PrintRequestAttributeSet attributeSet)
{
@@ -377,7 +415,8 @@ public final class AttributeSetUtilities
/**
* Returns an unmodifiable view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to make unmodifiable.
+ * @return The unmodifiable attribute set.
*/
public static PrintServiceAttributeSet unmodifiableView(PrintServiceAttributeSet attributeSet)
{
@@ -386,8 +425,10 @@ public final class AttributeSetUtilities
/**
* Verifies that the given object is a <code>Class</code> that
- * implements the given interface name.
- *
+ * implements the given interface name and returns it casted.
+ *
+ * @param object the object to test.
+ * @param interfaceName the <code>Class</code> to verify against.
* @return object casted to <code>Class</code>
*
* @exception ClassCastException if object is not a <code>Class</code>
@@ -410,7 +451,10 @@ public final class AttributeSetUtilities
/**
* Verifies that the given object is an attribute of the given interface.
- *
+ * and returns it casted to the interface type.
+ *
+ * @param object the object to test.
+ * @param interfaceName the <code>Class</code> to verify against.
* @return the object casted to <code>Attribute</code>
*
* @exception ClassCastException if object is no instance of interfaceName.
@@ -429,10 +473,11 @@ public final class AttributeSetUtilities
}
/**
- * Verifies that the category of attribute is equals to category.
- *
- * @param category the category the atteribute should be
- * @param attribute the attribute to verify
+ * Verifies that the category of attribute is equals to the given category
+ * class.
+ *
+ * @param category the category to test.
+ * @param attribute the attribute to verify.
*
* @exception IllegalArgumentException if the categories are not equal
* @exception NullPointerException if category is null
@@ -440,10 +485,10 @@ public final class AttributeSetUtilities
public static void verifyCategoryForValue(Class category,
Attribute attribute)
{
- if (category == null)
- throw new NullPointerException("object may not be null");
+ if (category == null || attribute == null)
+ throw new NullPointerException("category or attribute may not be null");
- if (category.equals(attribute.getCategory()))
+ if (!category.equals(attribute.getCategory()))
throw new IllegalArgumentException
("category of attribute not equal to category");
}
diff --git a/libjava/classpath/javax/print/attribute/DateTimeSyntax.java b/libjava/classpath/javax/print/attribute/DateTimeSyntax.java
index 0e583e0..d591932 100644
--- a/libjava/classpath/javax/print/attribute/DateTimeSyntax.java
+++ b/libjava/classpath/javax/print/attribute/DateTimeSyntax.java
@@ -1,5 +1,5 @@
/* DateTimeSyntax.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,10 @@ import java.io.Serializable;
import java.util.Date;
/**
- * @author Michael Koch
+ * <code>DateTimeSyntax</code> is the abstract base class of all attribute
+ * classes having a date and a time as value.
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public abstract class DateTimeSyntax implements Cloneable, Serializable
{
@@ -52,7 +55,7 @@ public abstract class DateTimeSyntax implements Cloneable, Serializable
/**
* Creates a <code>DateTimeSyntax</code> with a given value.
*
- * @param value the value for this syntax
+ * @param value the date for this syntax
*
* @exception NullPointerException if value is null
*/
@@ -67,7 +70,7 @@ public abstract class DateTimeSyntax implements Cloneable, Serializable
/**
* Returns the date value of this object.
*
- * @return the date value
+ * @return The date value.
*/
public Date getValue()
{
@@ -79,7 +82,8 @@ public abstract class DateTimeSyntax implements Cloneable, Serializable
*
* @param obj the object to test
*
- * @return True if both objects are equal, false otherwise.
+ * @return <code>true</code> if both objects are equal,
+ * <code>false</code> otherwise.
*/
public boolean equals(Object obj)
{
@@ -92,7 +96,7 @@ public abstract class DateTimeSyntax implements Cloneable, Serializable
/**
* Returns the hashcode for this object.
*
- * @return the hashcode
+ * @return The hashcode.
*/
public int hashCode()
{
diff --git a/libjava/classpath/javax/print/attribute/DocAttribute.java b/libjava/classpath/javax/print/attribute/DocAttribute.java
index 669d7d9..9af3a70 100644
--- a/libjava/classpath/javax/print/attribute/DocAttribute.java
+++ b/libjava/classpath/javax/print/attribute/DocAttribute.java
@@ -1,5 +1,5 @@
/* DocAttribute.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,23 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * Marker interface for all attribute classes describing attributes of
+ * a {@link javax.print.Doc} object.
+ * <p>
+ * Instances of implementing attribute classes may be collected in a
+ * {@link javax.print.attribute.DocAttributeSet}.
+ * </p><p>
+ * Attributes attached to a {@link javax.print.Doc} instance specify how the
+ * data should be printed.
+ * For example {@link javax.print.attribute.standard.Chromaticity} can be
+ * used to specify that a doc should be printed in color or monochrome.
+ * </p>
+ *
+ * @see javax.print.attribute.DocAttributeSet
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface DocAttribute extends Attribute
{
+ // Marker interface
}
diff --git a/libjava/classpath/javax/print/attribute/DocAttributeSet.java b/libjava/classpath/javax/print/attribute/DocAttributeSet.java
index 72cd6d8..d8d09eb 100644
--- a/libjava/classpath/javax/print/attribute/DocAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/DocAttributeSet.java
@@ -1,5 +1,5 @@
/* DocAttributeSet.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,18 +38,45 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * <code>DocAttributeSet</code> specifies an attribute set which only
+ * allows printing attributes of type
+ * {@link javax.print.attribute.DocAttribute}.
+ * <p>
+ * The methods {@link #add(Attribute)} and {@link #addAll(AttributeSet)} are
+ * respecified in this interface to indicate that only
+ * <code>DocAttribute</code> instances are allowed in this set.
+ * </p>
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface DocAttributeSet extends AttributeSet
{
/**
- * Adds the specified attribute value to this attribute set
+ * Adds the specified attribute value to this attribute set
* if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if attribute is not of type
+ * <code>DocAttribute</code>.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
boolean add (Attribute attribute);
/**
- * Adds all of the elements in the specified set to this attribute.
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if one of the attributes is not of type
+ * <code>DocAttribute</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
*/
boolean addAll (AttributeSet attributes);
}
diff --git a/libjava/classpath/javax/print/attribute/EnumSyntax.java b/libjava/classpath/javax/print/attribute/EnumSyntax.java
index 3ed79fc..9a5e62d 100644
--- a/libjava/classpath/javax/print/attribute/EnumSyntax.java
+++ b/libjava/classpath/javax/print/attribute/EnumSyntax.java
@@ -1,5 +1,5 @@
/* EnumSyntax.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,10 +37,69 @@ exception statement from your version. */
package javax.print.attribute;
+import java.io.InvalidObjectException;
+import java.io.ObjectStreamException;
import java.io.Serializable;
/**
- * @author Michael Koch
+ * <code>EnumSyntax</code> is the abstract base class of all enumeration
+ * classes in the Java Print Service API.
+ * <p>
+ * Every enumeration class which extends from EnumSyntax provides several
+ * enumeration objects as singletons of its class.
+ * </p>
+ * <p>
+ * Notes for implementing subclasses:
+ * <ul>
+ * <li>
+ * The values of all enumeration singelton instances have to be in a
+ * sequence which may start at any value. See: {@link #getOffset()}
+ * </li>
+ * <li>
+ * Subclasses have to override {@link #getEnumValueTable()} and should
+ * override {@link #getStringTable()} for correct serialization.
+ * </li>
+ * </ul>
+ * </p>
+ * Example:
+ * <pre>
+ * public class PrinterState extends EnumSyntax
+ * {
+ * public static final PrinterState IDLE = new PrinterState(1);
+ * public static final PrinterState PROCESSING = new PrinterState(2);
+ * public static final PrinterState STOPPED = new PrinterState(3);
+ *
+ * protected PrinterState(int value)
+ * {
+ * super(value);
+ * }
+ *
+ * // Overridden because values start not at zero !
+ * protected int getOffset()
+ * {
+ * return 1;
+ * }
+ *
+ * private static final String[] stringTable = { "idle", "processing",
+ * "stopped" };
+ *
+ * protected String[] getStringTable()
+ * {
+ * return stringTable;
+ * }
+ *
+ * private static final PrinterState[] enumValueTable = { IDLE,
+ * PROCESSING, STOPPED};
+ *
+ * protected EnumSyntax[] getEnumValueTable()
+ * {
+ * return enumValueTable;
+ * }
+ * }
+ * </pre>
+ *
+ * @author Michael Koch (konqueror@gmx.de)
+ * @author Wolfgang Baer (WBaer@gmx.de)
*/
public abstract class EnumSyntax implements Cloneable, Serializable
{
@@ -51,7 +110,7 @@ public abstract class EnumSyntax implements Cloneable, Serializable
/**
* Creates a <code>EnumSyntax</code> object.
*
- * @param value the value to set
+ * @param value the value to set.
*/
protected EnumSyntax(int value)
{
@@ -59,9 +118,9 @@ public abstract class EnumSyntax implements Cloneable, Serializable
}
/**
- * Returns the value of this object.
+ * Returns the value of this enumeration object.
*
- * @return the value
+ * @return The value.
*/
public int getValue()
{
@@ -71,7 +130,7 @@ public abstract class EnumSyntax implements Cloneable, Serializable
/**
* Clones this object.
*
- * @return a clone of this object
+ * @return A clone of this object.
*/
public Object clone()
{
@@ -87,9 +146,10 @@ public abstract class EnumSyntax implements Cloneable, Serializable
}
/**
- * Returns the hashcode for this object.
+ * Returns the hashcode for this object.
+ * The hashcode is the value of this enumeration object.
*
- * @return the hashcode
+ * @return The hashcode.
*/
public int hashCode()
{
@@ -98,8 +158,11 @@ public abstract class EnumSyntax implements Cloneable, Serializable
/**
* Returns the string representation for this object.
+ * The string value from <code>getStringTable()</code> method is returned
+ * if subclasses override this method. Otherwise the value of this object
+ * as a string is returned.
*
- * @return the string representation
+ * @return The string representation.
*/
public String toString()
{
@@ -118,9 +181,10 @@ public abstract class EnumSyntax implements Cloneable, Serializable
* Returns a table with the enumeration values represented as strings
* for this object.
*
- * The default implementation just returns null.
+ * The default implementation just returns null. Subclasses should
+ * override this method.
*
- * @return the enumeration values as strings
+ * @return The enumeration values as strings.
*/
protected String[] getStringTable()
{
@@ -128,17 +192,49 @@ public abstract class EnumSyntax implements Cloneable, Serializable
}
/**
+ * Needed for singelton semantics during deserialisation.
+ *
+ * Subclasses must not override this class. Subclasses have to override
+ * <code>getEnumValueTable()</code> and should override
+ * <code>getStringTable()</code> for correct serialization.
+ *
+ * @return The Object at index <code>value - getOffset()</code>
+ * in getEnumValueTable.
+ * @throws ObjectStreamException if getEnumValueTable() returns null.
+ */
+ protected Object readResolve() throws ObjectStreamException
+ {
+ EnumSyntax[] table = getEnumValueTable();
+ if (table == null)
+ throw new InvalidObjectException("Null enumeration value table "
+ + "for class "
+ + this.getClass().toString());
+
+ return table[value - getOffset()];
+ }
+
+ /**
* Returns a table with the enumeration values for this object.
*
- * The default implementation just returns null.
+ * The default implementation just returns null. Subclasses have to
+ * to override this method for serialization.
*
- * @return the enumeration values
+ * @return The enumeration values.
*/
protected EnumSyntax[] getEnumValueTable()
{
return null;
}
+ /**
+ * Returns the lowest used value by the enumerations of this class.
+ *
+ * The default implementation returns 0. This is enough if enumerations
+ * start with a zero value. Otherwise subclasses need to override this
+ * method for serialization and return the lowest value they use.
+ * .
+ * @return The lowest used value used.
+ */
protected int getOffset()
{
return 0;
diff --git a/libjava/classpath/javax/print/attribute/HashAttributeSet.java b/libjava/classpath/javax/print/attribute/HashAttributeSet.java
index c5fbe5e..0db81ba 100644
--- a/libjava/classpath/javax/print/attribute/HashAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/HashAttributeSet.java
@@ -1,5 +1,5 @@
/* HashAttributeSet.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,10 @@ import java.io.Serializable;
import java.util.HashMap;
import java.util.Iterator;
+/**
+ * <code>HashAttributeSet</code> provides an implementation of
+ * {@link javax.print.attribute.AttributeSet}.
+ */
public class HashAttributeSet implements AttributeSet, Serializable
{
private static final long serialVersionUID = 5311560590283707917L;
@@ -73,9 +77,11 @@ public class HashAttributeSet implements AttributeSet, Serializable
* Creates a <code>HashAttributeSet</code> object with the given
* attributes in it.
*
- * @param attributes the attributes to put into the set
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
*
- * @exception NullPointerException If attributes is null
+ * @exception NullPointerException if one of the attributes of the given
+ * array is null.
*/
public HashAttributeSet(Attribute[] attributes)
{
@@ -83,12 +89,11 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Creates a <code>HashAttributeSet</code> object with the given
- * attributes in it.
- *
- * @param attributes the attributes to put into the set
+ * Creates a <code>HashAttributeSet</code> object with attributes
+ * of the given attributes set in it.
*
- * @exception NullPointerException If attributes is null
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
*/
public HashAttributeSet(AttributeSet attributes)
{
@@ -111,7 +116,11 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Creates an empty <code>HashAttributeSet</code> object.
+ * Creates a <code>HashAttributeSet</code> object with the given
+ * attribute in it.
+ *
+ * @param attribute the attribute to put into the set.
+ * @param interfaceName the interface that all members must implement.
*
* @exception ClassCastException if attribute is not an interface of
* interfaceName
@@ -128,7 +137,12 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Creates an empty <code>HashAttributeSet</code> object.
+ * Creates a <code>HashAttributeSet</code> object with the given
+ * attributes in it.
+ *
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
+ * @param interfaceName the interface that all members must implement.
*
* @exception ClassCastException if any element of attributes is not an
* interface of interfaceName
@@ -138,15 +152,20 @@ public class HashAttributeSet implements AttributeSet, Serializable
{
this(interfaceName);
- if (attributes == null)
- throw new NullPointerException();
-
- for (int index = 0; index < attributes.length; index++)
- addInternal(attributes[index], interfaceName);
+ if (attributes != null)
+ {
+ for (int index = 0; index < attributes.length; index++)
+ addInternal(attributes[index], interfaceName);
+ }
}
/**
- * Creates an empty <code>HashAttributeSet</code> object.
+ * Creates a <code>HashAttributeSet</code> object with attributes
+ * of the given attributes set in it.
+ *
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
+ * @param interfaceName the interface that all members must implement.
*
* @exception ClassCastException if any element of attributes is not an
* interface of interfaceName
@@ -160,15 +179,16 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * 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.
+ * Adds the specified attribute value to this attribute set
+ * if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute to the set.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
public boolean add(Attribute attribute)
{
@@ -190,14 +210,13 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * 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.
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
*/
public boolean addAll(AttributeSet attributes)
{
@@ -218,9 +237,8 @@ public class HashAttributeSet implements AttributeSet, Serializable
/**
* Removes all attributes from this attribute set.
- *
- * @exception UnmodifiableSetException if this attribute set does not
- * support this action.
+ *
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
public void clear()
{
@@ -228,11 +246,12 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Checks if this attribute set contains an entry with the given category.
- *
- * @param category the category to test for
- *
- * @return true if the category exists in this attribute set, false otherwise.
+ * Checks if this attributes set contains an attribute with the given
+ * category.
+ *
+ * @param category the category to test for.
+ * @return <code>true</code> if an attribute of the category is contained
+ * in the set, <code>false</code> otherwise.
*/
public boolean containsKey(Class category)
{
@@ -240,12 +259,11 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Checks if this attribute set contains an entry with the given attribute.
- *
- * @param attribute the attribute to test for
- *
- * @return true if the attribute exists in this attribute set,
- * false otherwise.
+ * Checks if this attribute set contains the given attribute.
+ *
+ * @param attribute the attribute to test for.
+ * @return <code>true</code> if the attribute is contained in the set,
+ * <code>false</code> otherwise.
*/
public boolean containsValue(Attribute attribute)
{
@@ -253,11 +271,12 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Tests of obj is equal to this object.
- *
- * @param obj the object to test
- *
- * @return true if both objects are equal, false otherwise.
+ * Tests this set for equality with the given object. <code>true</code> is
+ * returned, if the given object is also of type <code>AttributeSet</code>
+ * and the contained attributes are the same as in this set.
+ *
+ * @param obj the Object to test.
+ * @return <code>true</code> if equal, false otherwise.
*/
public boolean equals(Object obj)
{
@@ -268,33 +287,45 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * 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
+ * Returns the attribute object contained in this set for the given attribute
+ * category.
+ *
+ * @param category the category of the attribute. A <code>Class</code>
+ * instance of a class implementing the <code>Attribute</code> interface.
+ * @return The attribute for this category or <code>null</code> if no
+ * attribute is contained for the given category.
+ * @throws NullPointerException if category is null.
+ * @throws ClassCastException if category is not implementing
+ * <code>Attribute</code>.
*/
public Attribute get(Class category)
{
+ if (category == null)
+ throw new NullPointerException("category may not be null");
+
return (Attribute) attributeMap.get(category);
}
/**
- * Returns the hashcode for this object.
- *
- * @return the hashcode
+ * Returns the hashcode value. The hashcode value is the sum of all hashcodes
+ * of the attributes contained in this set.
+ *
+ * @return The hashcode for this attribute set.
*/
public int hashCode()
{
- return attributeMap.hashCode() + interfaceName.hashCode();
+ int hashcode = 0;
+ Iterator it = attributeMap.values().iterator();
+ while (it.hasNext())
+ hashcode = hashcode + it.next().hashCode();
+
+ return hashcode;
}
/**
* Checks if the attribute set is empty.
*
- * @return true if the attribute set is empty, false otherwise
+ * @return <code>true</code> if the attribute set is empty, false otherwise.
*/
public boolean isEmpty()
{
@@ -302,14 +333,12 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * 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.
+ * Removes the given attribute from the set. If the given attribute is <code>null</code>
+ * nothing is done and <code>false</code> is returned.
+ *
+ * @param attribute the attribute to remove.
+ * @return <code>true</code> if removed, false in all other cases.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
public boolean remove(Attribute attribute)
{
@@ -320,11 +349,12 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * 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.
+ * Removes the attribute entry of the given category from the set. If the given
+ * category is <code>null</code> nothing is done and <code>false</code> is returned.
+ *
+ * @param category the category of the entry to be removed.
+ * @return <code>true</code> if an attribute is removed, false in all other cases.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
public boolean remove(Class category)
{
@@ -337,7 +367,7 @@ public class HashAttributeSet implements AttributeSet, Serializable
/**
* Returns the number of elements in this attribute set.
*
- * @return the number of elements.
+ * @return The number of elements.
*/
public int size()
{
@@ -347,12 +377,12 @@ public class HashAttributeSet implements AttributeSet, Serializable
/**
* Returns the content of the attribute set as an array
*
- * @return an array of attributes
+ * @return An array of attributes.
*/
public Attribute[] toArray()
{
int index = 0;
- Iterator it = attributeMap.entrySet().iterator();
+ Iterator it = attributeMap.values().iterator();
Attribute[] array = new Attribute[size()];
while (it.hasNext())
diff --git a/libjava/classpath/javax/print/attribute/HashDocAttributeSet.java b/libjava/classpath/javax/print/attribute/HashDocAttributeSet.java
index 1647ae2..2317db3 100644
--- a/libjava/classpath/javax/print/attribute/HashDocAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/HashDocAttributeSet.java
@@ -1,5 +1,5 @@
/* HashDocAttributeSet.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,10 @@ package javax.print.attribute;
import java.io.Serializable;
+/**
+ * <code>HashDocAttributeSet</code> provides an implementation of
+ * {@link javax.print.attribute.DocAttributeSet}.
+ */
public class HashDocAttributeSet extends HashAttributeSet
implements DocAttributeSet, Serializable
{
@@ -56,7 +60,7 @@ public class HashDocAttributeSet extends HashAttributeSet
* Creates a <code>HashDocAttributeSet</code> object with the given
* attribute in it.
*
- * @param attribute the attriute tu put into the attribute set
+ * @param attribute the attribute to put into the attribute set
*
* @exception NullPointerException if attribute is null
*/
@@ -69,9 +73,11 @@ public class HashDocAttributeSet extends HashAttributeSet
* Creates a <code>HashDocAttributeSet</code> object with the given
* attributes in it.
*
- * @param attributes the attributes to put into the attribute set
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
*
- * @exception NullPointerException if attributes is null
+ * @exception NullPointerException if one of the attributes of the given
+ * array is null.
*/
public HashDocAttributeSet(DocAttribute[] attributes)
{
@@ -79,11 +85,11 @@ public class HashDocAttributeSet extends HashAttributeSet
}
/**
- * Creates a <code>HashDocAttributeSet</code> object with the given
- * attributes in it.
- *
- * @param attributes the attributes to put into the attribute set
+ * Creates a <code>HashDocAttributeSet</code> object with the attributes
+ * of the given attributes set in it.
*
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
* @exception ClassCastException if any element of attributes is not
* an instance of <code>DocAttribute</code>
*/
diff --git a/libjava/classpath/javax/print/attribute/HashPrintJobAttributeSet.java b/libjava/classpath/javax/print/attribute/HashPrintJobAttributeSet.java
index 84fa7ec..ac4c902 100644
--- a/libjava/classpath/javax/print/attribute/HashPrintJobAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/HashPrintJobAttributeSet.java
@@ -1,5 +1,5 @@
/* HashPrintJobAttributeSet.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,10 @@ package javax.print.attribute;
import java.io.Serializable;
+/**
+ * <code>HashPrintJobAttributeSet</code> provides an implementation of
+ * {@link javax.print.attribute.PrintJobAttributeSet}.
+ */
public class HashPrintJobAttributeSet extends HashAttributeSet
implements Serializable, PrintJobAttributeSet
{
@@ -56,7 +60,7 @@ public class HashPrintJobAttributeSet extends HashAttributeSet
* Creates a <code>HashPrintJobAttributeSet</code> object with the given
* attribute in it.
*
- * @param attribute the attriute tu put into the attribute set
+ * @param attribute the attribute to put into the attribute set
*
* @exception NullPointerException if attribute is null
*/
@@ -69,9 +73,11 @@ public class HashPrintJobAttributeSet extends HashAttributeSet
* Creates a <code>HashPrintJobAttributeSet</code> object with the given
* attributes in it.
*
- * @param attributes the attributes to put into the attribute set
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
*
- * @exception NullPointerException if attributes is null
+ * @exception NullPointerException if one of the attributes of the given
+ * array is null.
*/
public HashPrintJobAttributeSet(PrintJobAttribute[] attributes)
{
@@ -79,11 +85,11 @@ public class HashPrintJobAttributeSet extends HashAttributeSet
}
/**
- * Creates a <code>HashPrintJobAttributeSet</code> object with the given
- * attributes in it.
- *
- * @param attributes the attributes to put into the attribute set
+ * Creates a <code>HashPrintJobAttributeSet</code> object with the attributes
+ * of the given attributes set in it.
*
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
* @exception ClassCastException if any element of attributes is not
* an instance of <code>PrintJobAttribute</code>
*/
diff --git a/libjava/classpath/javax/print/attribute/HashPrintRequestAttributeSet.java b/libjava/classpath/javax/print/attribute/HashPrintRequestAttributeSet.java
index 29a1786..e74c0e0 100644
--- a/libjava/classpath/javax/print/attribute/HashPrintRequestAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/HashPrintRequestAttributeSet.java
@@ -1,5 +1,5 @@
/* HashPrintRequestAttributeSet.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,10 @@ package javax.print.attribute;
import java.io.Serializable;
+/**
+ * <code>HashPrintRequestAttributeSet</code> provides an implementation of
+ * {@link javax.print.attribute.PrintRequestAttributeSet}.
+ */
public class HashPrintRequestAttributeSet extends HashAttributeSet
implements Serializable, PrintRequestAttributeSet
{
@@ -56,7 +60,7 @@ public class HashPrintRequestAttributeSet extends HashAttributeSet
* Creates a <code>HashPrintRequestAttributeSet</code> object with the given
* attribute in it.
*
- * @param attribute the attriute tu put into the attribute set
+ * @param attribute the attribute to put into the attribute set
*
* @exception NullPointerException if attribute is null
*/
@@ -69,9 +73,11 @@ public class HashPrintRequestAttributeSet extends HashAttributeSet
* Creates a <code>HashPrintRequestAttributeSet</code> object with the given
* attributes in it.
*
- * @param attributes the attributes to put into the attribute set
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
*
- * @exception NullPointerException if attributes is null
+ * @exception NullPointerException if one of the attributes of the given
+ * array is null.
*/
public HashPrintRequestAttributeSet(PrintRequestAttribute[] attributes)
{
@@ -79,11 +85,11 @@ public class HashPrintRequestAttributeSet extends HashAttributeSet
}
/**
- * Creates a <code>HashPrintRequestAttributeSet</code> object with the given
- * attributes in it.
- *
- * @param attributes the attributes to put into the attribute set
+ * Creates a <code>HashPrintRequestAttributeSet</code> object with the attributes
+ * of the given attributes set in it.
*
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
* @exception ClassCastException if any element of attributes is not
* an instance of <code>PrintRequestAttribute</code>
*/
diff --git a/libjava/classpath/javax/print/attribute/HashPrintServiceAttributeSet.java b/libjava/classpath/javax/print/attribute/HashPrintServiceAttributeSet.java
index 60e12bf..155514f 100644
--- a/libjava/classpath/javax/print/attribute/HashPrintServiceAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/HashPrintServiceAttributeSet.java
@@ -1,5 +1,5 @@
/* HashPrintServiceAttributeSet.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,10 @@ package javax.print.attribute;
import java.io.Serializable;
+/**
+ * <code>HashPrintServiceAttributeSet</code> provides an implementation of
+ * {@link javax.print.attribute.PrintServiceAttributeSet}.
+ */
public class HashPrintServiceAttributeSet extends HashAttributeSet
implements Serializable, PrintServiceAttributeSet
{
@@ -56,7 +60,7 @@ public class HashPrintServiceAttributeSet extends HashAttributeSet
* Creates a <code>HashPrintServiceAttributeSet</code> object with the given
* attribute in it.
*
- * @param attribute the attriute tu put into the attribute set
+ * @param attribute the attribute to put into the attribute set
*
* @exception NullPointerException if attribute is null
*/
@@ -69,9 +73,11 @@ public class HashPrintServiceAttributeSet extends HashAttributeSet
* Creates a <code>HashPrintServiceAttributeSet</code> object with the given
* attributes in it.
*
- * @param attributes the attributes to put into the attribute set
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
*
- * @exception NullPointerException if attributes is null
+ * @exception NullPointerException if one of the attributes of the given
+ * array is null.
*/
public HashPrintServiceAttributeSet(PrintServiceAttribute[] attributes)
{
@@ -79,11 +85,11 @@ public class HashPrintServiceAttributeSet extends HashAttributeSet
}
/**
- * Creates a <code>HashPrintServiceAttributeSet</code> object with the given
- * attributes in it.
- *
- * @param attributes the attributes to put into the attribute set
+ * Creates a <code>HashPrintServiceAttributeSet</code> object with the attributes
+ * of the given attributes set in it.
*
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
* @exception ClassCastException if any element of attributes is not
* an instance of <code>PrintServiceAttribute</code>
*/
diff --git a/libjava/classpath/javax/print/attribute/IntegerSyntax.java b/libjava/classpath/javax/print/attribute/IntegerSyntax.java
index d5500b4..c2f9224 100644
--- a/libjava/classpath/javax/print/attribute/IntegerSyntax.java
+++ b/libjava/classpath/javax/print/attribute/IntegerSyntax.java
@@ -1,5 +1,5 @@
/* IntegerSyntax.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,7 +40,10 @@ package javax.print.attribute;
import java.io.Serializable;
/**
- * @author Michael Koch
+ * <code>IntegerSyntax</code> is the abstract base class of all attribute
+ * classes having an integer as value.
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public abstract class IntegerSyntax implements Cloneable, Serializable
{
@@ -49,7 +52,7 @@ public abstract class IntegerSyntax implements Cloneable, Serializable
/**
* Creates a <code>IntegerSyntax</code> with the given value.
*
- * @param value the value to set
+ * @param value the integer to set
*/
protected IntegerSyntax(int value)
{
@@ -57,9 +60,10 @@ public abstract class IntegerSyntax implements Cloneable, Serializable
}
/**
- * Creates a <code>IntegerSyntax</code> with the given arguments.
+ * Creates a <code>IntegerSyntax</code> with the given integer value
+ * and checks if the value lies inside the given bounds..
*
- * @param value the value to set
+ * @param value the integer to set
* @param lowerBound the lower bound for the value
* @param upperBound the upper bound for the value
*
@@ -78,7 +82,7 @@ public abstract class IntegerSyntax implements Cloneable, Serializable
/**
* Returns the value of this object.
*
- * @return the value
+ * @return The integer value.
*/
public int getValue()
{
@@ -86,11 +90,12 @@ public abstract class IntegerSyntax implements Cloneable, Serializable
}
/**
- * Tests of obj is equal to this object.
+ * Tests if the given object is equal to this object.
*
* @param obj the object to test
*
- * @return true if both objects are equal, false otherwise.
+ * @return <code>true</code> if both objects are equal,
+ * <code>false</code> otherwise.
*/
public boolean equals(Object obj)
{
@@ -103,7 +108,7 @@ public abstract class IntegerSyntax implements Cloneable, Serializable
/**
* Returns the hashcode for this object.
*
- * @return the hashcode
+ * @return The hashcode.
*/
public int hashCode()
{
@@ -113,7 +118,7 @@ public abstract class IntegerSyntax implements Cloneable, Serializable
/**
* Returns the string representation for this object.
*
- * @return the string representation
+ * @return The string representation.
*/
public String toString()
{
diff --git a/libjava/classpath/javax/print/attribute/PrintJobAttribute.java b/libjava/classpath/javax/print/attribute/PrintJobAttribute.java
index ba3a737..fd36634 100644
--- a/libjava/classpath/javax/print/attribute/PrintJobAttribute.java
+++ b/libjava/classpath/javax/print/attribute/PrintJobAttribute.java
@@ -1,5 +1,5 @@
/* PrintJobAttribute.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,23 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * Marker interface for all attribute classes describing attributes or the
+ * status of a ({@link javax.print.DocPrintJob} object.
+ * <p>
+ * Instances of implementing attribute classes may be collected in a
+ * {@link javax.print.attribute.PrintJobAttributeSet}.
+ * </p><p>
+ * A print service uses attributes of this type to inform about the status
+ * of a print job.
+ * For example {@link javax.print.attribute.standard.DateTimeAtProcessing}
+ * is used to report at which date and time a job has started processing.
+ * </p>
+ *
+ * @see javax.print.attribute.PrintJobAttributeSet
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface PrintJobAttribute extends Attribute
{
+ // Marker interface
}
diff --git a/libjava/classpath/javax/print/attribute/PrintJobAttributeSet.java b/libjava/classpath/javax/print/attribute/PrintJobAttributeSet.java
index 905d53c..6283ae1 100644
--- a/libjava/classpath/javax/print/attribute/PrintJobAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/PrintJobAttributeSet.java
@@ -1,5 +1,5 @@
/* PrintJobAttributeSet.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,18 +38,45 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * <code>PrintJobAttributeSet</code> specifies an attribute set which only
+ * allows printing attributes of type
+ * {@link javax.print.attribute.PrintJobAttribute}.
+ * <p>
+ * The methods {@link #add(Attribute)} and {@link #addAll(AttributeSet)} are
+ * respecified in this interface to indicate that only
+ * <code>PrintJobAttribute</code> instances are allowed in this set.
+ * </p>
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface PrintJobAttributeSet extends AttributeSet
{
/**
- * Adds the specified attribute value to this attribute set
+ * Adds the specified attribute value to this attribute set
* if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if attribute is not of type
+ * <code>PrintJobAttribute</code>.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
boolean add (Attribute attribute);
/**
- * Adds all of the elements in the specified set to this attribute.
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if one of the attributes is not of type
+ * <code>PrintJobAttribute</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
*/
boolean addAll (AttributeSet attributes);
}
diff --git a/libjava/classpath/javax/print/attribute/PrintRequestAttribute.java b/libjava/classpath/javax/print/attribute/PrintRequestAttribute.java
index 7563500..8a05b75d 100644
--- a/libjava/classpath/javax/print/attribute/PrintRequestAttribute.java
+++ b/libjava/classpath/javax/print/attribute/PrintRequestAttribute.java
@@ -1,5 +1,5 @@
/* PrintRequestAttribute.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,18 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * Marker interface for all attribute classes which specify a requested
+ * attribute of {@link javax.print.DocPrintJob} object.
+ * <p>
+ * Instances of implementing attribute classes may be collected in a
+ * {@link javax.print.attribute.PrintRequestAttributeSet}.
+ * </p>
+ *
+ * @see javax.print.attribute.PrintRequestAttributeSet
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface PrintRequestAttribute extends Attribute
{
+ // Marker interface
}
diff --git a/libjava/classpath/javax/print/attribute/PrintRequestAttributeSet.java b/libjava/classpath/javax/print/attribute/PrintRequestAttributeSet.java
index d72d2d7..350d9a6 100644
--- a/libjava/classpath/javax/print/attribute/PrintRequestAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/PrintRequestAttributeSet.java
@@ -1,5 +1,5 @@
/* PrintRequestAttributeSet.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,18 +38,45 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * <code>PrintRequestAttributeSet</code> specifies an attribute set which only
+ * allows printing attributes of type
+ * {@link javax.print.attribute.PrintRequestAttribute}.
+ * <p>
+ * The methods {@link #add(Attribute)} and {@link #addAll(AttributeSet)} are
+ * respecified in this interface to indicate that only
+ * <code>PrintRequestAttribute</code> instances are allowed in this set.
+ * </p>
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface PrintRequestAttributeSet extends AttributeSet
{
/**
- * Adds the specified attribute value to this attribute set
+ * Adds the specified attribute value to this attribute set
* if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if attribute is not of type
+ * <code>PrintRequestAttribute</code>.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
boolean add (Attribute attribute);
/**
- * Adds all of the elements in the specified set to this attribute.
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if one of the attributes is not of type
+ * <code>PrintRequestAttribute</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
*/
boolean addAll (AttributeSet attributes);
}
diff --git a/libjava/classpath/javax/print/attribute/PrintServiceAttribute.java b/libjava/classpath/javax/print/attribute/PrintServiceAttribute.java
index 3cf8825..213f437 100644
--- a/libjava/classpath/javax/print/attribute/PrintServiceAttribute.java
+++ b/libjava/classpath/javax/print/attribute/PrintServiceAttribute.java
@@ -1,5 +1,5 @@
/* PrintServiceAttribute.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,23 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * Marker interface for all attribute classes describing parameters
+ * or the status of a {@link javax.print.PrintService}.
+ * <p>
+ * Instances of implementing attribute classes may be collected in a
+ * {@link javax.print.attribute.PrintServiceAttributeSet}.
+ * </p><p>
+ * A print service uses attributes of this type to inform about the status
+ * or the specific capabilities of itself.
+ * For example {@link javax.print.attribute.standard.PagesPerMinute} is used
+ * to specify the average printable pages per minute of the print service.
+ * </p>
+ *
+ * @see javax.print.attribute.PrintServiceAttributeSet
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface PrintServiceAttribute extends Attribute
{
+ // Marker interface
}
diff --git a/libjava/classpath/javax/print/attribute/PrintServiceAttributeSet.java b/libjava/classpath/javax/print/attribute/PrintServiceAttributeSet.java
index d67c9af..fa22ee0 100644
--- a/libjava/classpath/javax/print/attribute/PrintServiceAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/PrintServiceAttributeSet.java
@@ -1,5 +1,5 @@
/* PrintServiceAttributeSet.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,18 +38,45 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * <code>PrintServiceAttributeSet</code> specifies an attribute set which only
+ * allows printing attributes of type
+ * {@link javax.print.attribute.PrintServiceAttribute}.
+ * <p>
+ * The methods {@link #add(Attribute)} and {@link #addAll(AttributeSet)} are
+ * respecified in this interface to indicate that only
+ * <code>PrintServiceAttribute</code> instances are allowed in this set.
+ * </p>
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface PrintServiceAttributeSet extends AttributeSet
{
/**
- * Adds the specified attribute value to this attribute set
+ * Adds the specified attribute value to this attribute set
* if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if attribute is not of type
+ * <code>PrintServiceAttribute</code>.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
boolean add (Attribute attribute);
/**
- * Adds all of the elements in the specified set to this attribute.
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if one of the attributes is not of type
+ * <code>PrintServiceAttribute</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
*/
boolean addAll (AttributeSet attributes);
}
diff --git a/libjava/classpath/javax/print/attribute/SetOfIntegerSyntax.java b/libjava/classpath/javax/print/attribute/SetOfIntegerSyntax.java
index d73b867..3990b66 100644
--- a/libjava/classpath/javax/print/attribute/SetOfIntegerSyntax.java
+++ b/libjava/classpath/javax/print/attribute/SetOfIntegerSyntax.java
@@ -38,7 +38,11 @@ exception statement from your version. */
package javax.print.attribute;
import java.io.Serializable;
-import java.util.Vector;
+import java.text.CharacterIterator;
+import java.text.StringCharacterIterator;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
/**
* @author Michael Koch
@@ -50,33 +54,41 @@ public abstract class SetOfIntegerSyntax
private int[][] members;
- private static int[][] normalize(Vector vecMembers)
+ private static int[][] normalize(int[][] values, int size)
{
- // XXX: Perhaps we should merge ranges that overlap.
-
- int current = 0;
- int[][] members = new int[vecMembers.size()][];
+ // Sort into increasing order. First the first index is
+ // compared, then the second.
+ Arrays.sort(values, 0, size, new Comparator()
+ {
+ public int compare(Object o1, Object o2)
+ {
+ int[] v1 = (int[]) o1;
+ int[] v2 = (int[]) o2;
+ if (v1[0] == v2[0])
+ return v1[1] - v2[1];
+ return v1[0] - v2[0];
+ }
+ });
- while (vecMembers.size() > 0)
+ // Now coalesce overlapping ranges.
+ int outIndex = 0;
+ for (int i = 0; i < size; ++i)
{
- // Search the lowest range.
- int[] range = (int[]) vecMembers.elementAt(0);
-
- for (int index = 1; index < vecMembers.size(); index++)
+ // Note that we compare with values[i][1]+1, since
+ // we can coalesce {0,1} with {2,x}.
+ int save = i;
+ while (i + 1 < size && values[i + 1][0] <= values[i][1] + 1)
{
- int[] tmp = (int[]) vecMembers.elementAt(index);
-
- if (range[0] > tmp[0]
- || (range[0] == tmp[0]
- && range[0] > tmp[0]))
- range = tmp;
+ values[i][1] = Math.max(values[i][1], values[i + 1][1]);
+ ++i;
}
-
- members[current] = range;
- current++;
+ values[outIndex++] = values[save];
}
- return members;
+ int[][] result = new int[outIndex][];
+ System.arraycopy(values, 0, result, 0, outIndex);
+
+ return result;
}
/**
@@ -104,10 +116,13 @@ public abstract class SetOfIntegerSyntax
*/
protected SetOfIntegerSyntax(int[][] members)
{
- Vector vecMembers = new Vector();
-
- if (members != null)
+ int[][] newMembers;
+ int outIndex = 0;
+ if (members == null)
+ newMembers = new int[0][];
+ else
{
+ newMembers = new int[members.length][];
for (int index = 0; index < members.length; index++)
{
int lower;
@@ -126,6 +141,7 @@ public abstract class SetOfIntegerSyntax
else
throw new IllegalArgumentException("invalid member element");
+ // We only want to reject non-null ranges where lower<0.
if (lower <= upper && lower < 0)
throw new IllegalArgumentException("invalid member element");
@@ -134,12 +150,81 @@ public abstract class SetOfIntegerSyntax
int[] range = new int[2];
range[0] = lower;
range[1] = upper;
- vecMembers.add(range);
+ newMembers[outIndex++] = range;
}
}
}
- this.members = normalize(vecMembers);
+ this.members = normalize(newMembers, outIndex);
+ }
+
+ private boolean skipWhitespace(StringCharacterIterator i)
+ {
+ while (Character.isWhitespace(i.current()))
+ i.next();
+ return i.current() == CharacterIterator.DONE;
+ }
+
+ private boolean skipNumber(StringCharacterIterator i)
+ {
+ boolean readAny = false;
+ while (Character.isDigit(i.current()))
+ {
+ readAny = true;
+ i.next();
+ }
+ return readAny;
+ }
+
+ protected SetOfIntegerSyntax(String s)
+ {
+ ArrayList vals = new ArrayList();
+
+ StringCharacterIterator it = new StringCharacterIterator(s);
+
+ while (true)
+ {
+ // Skip whitespace.
+ if (skipWhitespace(it))
+ break;
+
+ // Parse integer.
+ int index = it.getIndex();
+ if (! skipNumber(it))
+ throw new IllegalArgumentException();
+ int[] item = new int[2];
+ item[0] = Integer.parseInt(s.substring(index, it.getIndex()));
+
+ if (! skipWhitespace(it))
+ {
+ char c = it.current();
+ if (c == ':' || c == '-')
+ {
+ it.next();
+ if (skipWhitespace(it))
+ throw new IllegalArgumentException();
+ index = it.getIndex();
+ if (! skipNumber(it))
+ throw new IllegalArgumentException();
+ item[1] = Integer.parseInt(s.substring(index, it.getIndex()));
+ }
+ else
+ item[1] = item[0];
+ }
+ else
+ item[1] = item[0];
+
+ if (item[0] <= item[1])
+ vals.add(item);
+
+ if (skipWhitespace(it))
+ break;
+ if (it.current() != ',')
+ throw new IllegalArgumentException();
+ it.next();
+ }
+
+ members = normalize((int[][]) vals.toArray(new int[0][]), vals.size());
}
/**
@@ -153,6 +238,7 @@ public abstract class SetOfIntegerSyntax
*/
protected SetOfIntegerSyntax(int lowerBound, int upperBound)
{
+ // We only want to reject non-null ranges where lower<0.
if (lowerBound <= upperBound
&& lowerBound < 0)
throw new IllegalArgumentException();
@@ -175,7 +261,7 @@ public abstract class SetOfIntegerSyntax
{
if (value < members[index][0])
return false;
- else if (value < members[index][1])
+ else if (value <= members[index][1])
return true;
}
@@ -205,8 +291,16 @@ public abstract class SetOfIntegerSyntax
{
if (! (obj instanceof SetOfIntegerSyntax))
return false;
-
- throw new Error("not implemented");
+ SetOfIntegerSyntax other = (SetOfIntegerSyntax) obj;
+ if (other.members.length != members.length)
+ return false;
+ for (int i = 0; i < members.length; ++i)
+ {
+ if (members[i][0] != other.members[i][0]
+ || members[i][1] != other.members[i][1])
+ return false;
+ }
+ return true;
}
/**
@@ -216,7 +310,7 @@ public abstract class SetOfIntegerSyntax
*/
public int[][] getMembers()
{
- throw new Error("not implemented");
+ return (int[][]) members.clone();
}
/**
@@ -226,11 +320,14 @@ public abstract class SetOfIntegerSyntax
*/
public int hashCode()
{
- throw new Error("not implemented");
+ int result = 0;
+ for (int i = 0; i < members.length; ++i)
+ result += members[i][0] + members[i][1];
+ return result;
}
/**
- * Returns the smallest value that is greater then x.
+ * Returns the smallest value that is greater than x which is in this set.
*
* @param x an integer value
*
@@ -238,7 +335,16 @@ public abstract class SetOfIntegerSyntax
*/
public int next(int x)
{
- throw new Error("not implemented");
+ for (int i = 0; i < members.length; ++i)
+ {
+ if (x >= members[i][1])
+ continue;
+ if (x < members[i][0])
+ return members[i][0];
+ // X is in this range.
+ return x + 1;
+ }
+ return -1;
}
/**
@@ -248,6 +354,18 @@ public abstract class SetOfIntegerSyntax
*/
public String toString()
{
- throw new Error("not implemented");
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < members.length; ++i)
+ {
+ if (i > 0)
+ sb.append(',');
+ sb.append(members[i][0]);
+ if (members[i][0] != members[i][1])
+ {
+ sb.append('-');
+ sb.append(members[i][1]);
+ }
+ }
+ return sb.toString();
}
}
diff --git a/libjava/classpath/javax/print/attribute/SupportedValuesAttribute.java b/libjava/classpath/javax/print/attribute/SupportedValuesAttribute.java
index d0f4b65..a001e7e 100644
--- a/libjava/classpath/javax/print/attribute/SupportedValuesAttribute.java
+++ b/libjava/classpath/javax/print/attribute/SupportedValuesAttribute.java
@@ -1,5 +1,5 @@
-/* Attribute.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* SupportedValuesAttribute.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,22 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * Marker interface for all attribute classes specifying the
+ * supported/allowed values for another printing attribute class.
+ * <p>
+ * A {@link javax.print.PrintService} instance for example provides
+ * printing attribute classes implementing this interface to indicate
+ * that a specific attribute type is supported and if the supported values.
+ * </p><p>
+ * E.g. a {@link javax.print.attribute.standard.JobPrioritySupported}
+ * instance indicates that the attribute class
+ * {@link javax.print.attribute.standard.JobPriority} is supported and
+ * provides the number of the possible priority levels.
+ * </p>
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface SupportedValuesAttribute extends Attribute
{
+ // Marker interface
}
diff --git a/libjava/classpath/javax/print/attribute/URISyntax.java b/libjava/classpath/javax/print/attribute/URISyntax.java
index f0583f7..07deb4b 100644
--- a/libjava/classpath/javax/print/attribute/URISyntax.java
+++ b/libjava/classpath/javax/print/attribute/URISyntax.java
@@ -1,5 +1,5 @@
/* URISyntax.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,10 @@ import java.io.Serializable;
import java.net.URI;
/**
- * @author Michael Koch
+ * <code>URISyntax</code> is the abstract base class of all attribute
+ * classes having an Uniform Resource Identifier URI as value.
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public abstract class URISyntax
implements Cloneable, Serializable
@@ -66,11 +69,12 @@ public abstract class URISyntax
}
/**
- * Tests of obj is equal to this object.
+ * Tests if the given object is equal to this object.
*
* @param obj the object to test
*
- * @returns true if both objects are equal, false otherwise.
+ * @return <code>true</code> if both objects are equal,
+ * <code>false</code> otherwise.
*/
public boolean equals(Object obj)
{
@@ -83,7 +87,7 @@ public abstract class URISyntax
/**
* Returns the URI value of this syntax object.
*
- * @return the URI
+ * @return The URI.
*/
public URI getURI()
{
@@ -93,7 +97,7 @@ public abstract class URISyntax
/**
* Returns the hashcode for this object.
*
- * @return the hashcode
+ * @return The hashcode.
*/
public int hashCode()
{
@@ -103,7 +107,7 @@ public abstract class URISyntax
/**
* Returns the string representation for this object.
*
- * @return the string representation
+ * @return The string representation.
*/
public String toString()
{
diff --git a/libjava/classpath/javax/print/attribute/UnmodifiableSetException.java b/libjava/classpath/javax/print/attribute/UnmodifiableSetException.java
index 6785317..ed1687c 100644
--- a/libjava/classpath/javax/print/attribute/UnmodifiableSetException.java
+++ b/libjava/classpath/javax/print/attribute/UnmodifiableSetException.java
@@ -1,5 +1,5 @@
-/* Attribute.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* UnmodifiableSetException.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,10 +35,14 @@ 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
+ * Exception which is thrown if an operation on an unmodifiable set
+ * is invoked.
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*
* @since 1.4
*/
@@ -56,7 +60,7 @@ public class UnmodifiableSetException extends RuntimeException
* Creates a <code>UnmodifiableSetException</code>
* with the given message.
*
- * @param message the message for the exception
+ * @param message the message of the exception
*/
public UnmodifiableSetException(String message)
{
diff --git a/libjava/classpath/javax/print/attribute/package.html b/libjava/classpath/javax/print/attribute/package.html
index ba67d1a..37f24d5 100644
--- a/libjava/classpath/javax/print/attribute/package.html
+++ b/libjava/classpath/javax/print/attribute/package.html
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!-- package.html - describes classes in javax.print.attribute package.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,7 +40,10 @@ exception statement from your version. -->
<head><title>GNU Classpath - javax.print.attribute</title></head>
<body>
-<p></p>
-
+<p>Provides classes and interfaces describing the roles and
+syntax of attribute objects in the Java Print Service API.</p>
+<p>
+<b>Since:</b> 1.4
+</p>
</body>
</html>