DateTimeSyntax.java, [...]: New files.
authorMichael Koch <konqueror@gmx.de>
Sun, 21 Dec 2003 11:10:54 +0000 (11:10 +0000)
committerMichael Koch <mkoch@gcc.gnu.org>
Sun, 21 Dec 2003 11:10:54 +0000 (11:10 +0000)
2003-12-21  Michael Koch  <konqueror@gmx.de>

* javax/print/attribute/DateTimeSyntax.java,
javax/print/attribute/DocAttribute.java,
javax/print/attribute/DocAttributeSet.java,
javax/print/attribute/IntegerSyntax.java,
javax/print/attribute/ResolutionSyntax.java,
javax/print/attribute/Size2DSyntax.java,
javax/print/attribute/TextSyntax.java,
javax/print/attribute/URISyntax.java,
javax/print/attribute/UnmodifiableSetException.java: New files.
* Makefile.am (ordinary_java_source_files): Added new files.
* Makefile.in: Regenerated.

From-SVN: r74904

12 files changed:
libjava/ChangeLog
libjava/Makefile.am
libjava/Makefile.in
libjava/javax/print/attribute/DateTimeSyntax.java [new file with mode: 0644]
libjava/javax/print/attribute/DocAttribute.java [new file with mode: 0644]
libjava/javax/print/attribute/DocAttributeSet.java [new file with mode: 0644]
libjava/javax/print/attribute/IntegerSyntax.java [new file with mode: 0644]
libjava/javax/print/attribute/ResolutionSyntax.java [new file with mode: 0644]
libjava/javax/print/attribute/Size2DSyntax.java [new file with mode: 0644]
libjava/javax/print/attribute/TextSyntax.java [new file with mode: 0644]
libjava/javax/print/attribute/URISyntax.java [new file with mode: 0644]
libjava/javax/print/attribute/UnmodifiableSetException.java [new file with mode: 0644]

index bcbb24e..c9188be 100644 (file)
@@ -1,5 +1,19 @@
 2003-12-21  Michael Koch  <konqueror@gmx.de>
 
+       * javax/print/attribute/DateTimeSyntax.java,
+       javax/print/attribute/DocAttribute.java,
+       javax/print/attribute/DocAttributeSet.java,
+       javax/print/attribute/IntegerSyntax.java,
+       javax/print/attribute/ResolutionSyntax.java,
+       javax/print/attribute/Size2DSyntax.java,
+       javax/print/attribute/TextSyntax.java,
+       javax/print/attribute/URISyntax.java,
+       javax/print/attribute/UnmodifiableSetException.java: New files.
+       * Makefile.am (ordinary_java_source_files): Added new files.
+       * Makefile.in: Regenerated.
+
+2003-12-21  Michael Koch  <konqueror@gmx.de>
+
        * gnu/java/net/PlainDatagramSocketImpl.java
        (mcastGrp): Added documentation.
 
index 681f50e..0f7fab4 100644 (file)
@@ -1743,7 +1743,16 @@ javax/naming/ldap/UnsolicitedNotificationListener.java \
 javax/naming/OperationNotSupportedException.java \
 javax/print/attribute/Attribute.java \
 javax/print/attribute/AttributeSet.java \
+javax/print/attribute/DateTimeSyntax.java \
+javax/print/attribute/DocAttribute.java \
+javax/print/attribute/DocAttributeSet.java \
+javax/print/attribute/IntegerSyntax.java \
 javax/print/attribute/PrintRequestAttributeSet.java \
+javax/print/attribute/ResolutionSyntax.java \
+javax/print/attribute/Size2DSyntax.java \
+javax/print/attribute/TextSyntax.java \
+javax/print/attribute/UnmodifiableSetException.java \
+javax/print/attribute/URISyntax.java \
 javax/security/auth/x500/X500Principal.java \
 javax/sql/ConnectionEvent.java \
 javax/sql/ConnectionEventListener.java \
index 3f34455..cf4ff1f 100644 (file)
@@ -1459,7 +1459,16 @@ javax/naming/ldap/UnsolicitedNotificationListener.java \
 javax/naming/OperationNotSupportedException.java \
 javax/print/attribute/Attribute.java \
 javax/print/attribute/AttributeSet.java \
+javax/print/attribute/DateTimeSyntax.java \
+javax/print/attribute/DocAttribute.java \
+javax/print/attribute/DocAttributeSet.java \
+javax/print/attribute/IntegerSyntax.java \
 javax/print/attribute/PrintRequestAttributeSet.java \
+javax/print/attribute/ResolutionSyntax.java \
+javax/print/attribute/Size2DSyntax.java \
+javax/print/attribute/TextSyntax.java \
+javax/print/attribute/UnmodifiableSetException.java \
+javax/print/attribute/URISyntax.java \
 javax/security/auth/x500/X500Principal.java \
 javax/sql/ConnectionEvent.java \
 javax/sql/ConnectionEventListener.java \
@@ -4051,7 +4060,16 @@ DEP_FILES =  .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
 .deps/javax/naming/spi/Resolver.P .deps/javax/naming/spi/StateFactory.P \
 .deps/javax/print/attribute/Attribute.P \
 .deps/javax/print/attribute/AttributeSet.P \
+.deps/javax/print/attribute/DateTimeSyntax.P \
+.deps/javax/print/attribute/DocAttribute.P \
+.deps/javax/print/attribute/DocAttributeSet.P \
+.deps/javax/print/attribute/IntegerSyntax.P \
 .deps/javax/print/attribute/PrintRequestAttributeSet.P \
+.deps/javax/print/attribute/ResolutionSyntax.P \
+.deps/javax/print/attribute/Size2DSyntax.P \
+.deps/javax/print/attribute/TextSyntax.P \
+.deps/javax/print/attribute/URISyntax.P \
+.deps/javax/print/attribute/UnmodifiableSetException.P \
 .deps/javax/rmi/BAD_OPERATION.P .deps/javax/rmi/CORBA/ClassDesc.P \
 .deps/javax/rmi/CORBA/ObjectImpl.P \
 .deps/javax/rmi/CORBA/PortableRemoteObjectDelegate.P \
diff --git a/libjava/javax/print/attribute/DateTimeSyntax.java b/libjava/javax/print/attribute/DateTimeSyntax.java
new file mode 100644 (file)
index 0000000..6880f2b
--- /dev/null
@@ -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 <code>DateTimeSyntax</code> 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();
+  }
+}
diff --git a/libjava/javax/print/attribute/DocAttribute.java b/libjava/javax/print/attribute/DocAttribute.java
new file mode 100644 (file)
index 0000000..077fdaa
--- /dev/null
@@ -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
+{
+}
diff --git a/libjava/javax/print/attribute/DocAttributeSet.java b/libjava/javax/print/attribute/DocAttributeSet.java
new file mode 100644 (file)
index 0000000..200420b
--- /dev/null
@@ -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);
+}
diff --git a/libjava/javax/print/attribute/IntegerSyntax.java b/libjava/javax/print/attribute/IntegerSyntax.java
new file mode 100644 (file)
index 0000000..2b713bf
--- /dev/null
@@ -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 <code>IntegerSyntax</code> with the given value.
+   *
+   * @param value the value to set
+   */
+  protected IntegerSyntax(int value)
+  {
+    this.value = value;
+  }
+
+  /**
+   * Creates a <code>IntegerSyntax</code> 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;
+  }
+}
diff --git a/libjava/javax/print/attribute/ResolutionSyntax.java b/libjava/javax/print/attribute/ResolutionSyntax.java
new file mode 100644 (file)
index 0000000..150e198
--- /dev/null
@@ -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 <code>ResolutionSyntax</code> 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 then 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);
+  }
+}
diff --git a/libjava/javax/print/attribute/Size2DSyntax.java b/libjava/javax/print/attribute/Size2DSyntax.java
new file mode 100644 (file)
index 0000000..9474318
--- /dev/null
@@ -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 <code>Size2DSyntax</code> 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 then 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 <code>Size2DSyntax</code> 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;
+  }
+}
diff --git a/libjava/javax/print/attribute/TextSyntax.java b/libjava/javax/print/attribute/TextSyntax.java
new file mode 100644 (file)
index 0000000..51909be
--- /dev/null
@@ -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 <code>TextSyntax</code> 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()));
+  }
+}
diff --git a/libjava/javax/print/attribute/URISyntax.java b/libjava/javax/print/attribute/URISyntax.java
new file mode 100644 (file)
index 0000000..da2667d
--- /dev/null
@@ -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 = 3666874174847632203L;
+
+  private URI uri;
+
+  /**
+   * Creates a <code>URISyntax</code> 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();
+  }
+}
diff --git a/libjava/javax/print/attribute/UnmodifiableSetException.java b/libjava/javax/print/attribute/UnmodifiableSetException.java
new file mode 100644 (file)
index 0000000..83d389d
--- /dev/null
@@ -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 <code>UnmodifiableSetException</code>.
+   */
+  public UnmodifiableSetException()
+  {
+    super();
+  }
+
+  /**
+   * Creates a <code>UnmodifiableSetException</code>
+   * with the given message.
+   *
+   * @param message the message for the exception
+   */
+  public UnmodifiableSetException(String message)
+  {
+    super(message);
+  }
+}