harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r469773 [2/3] - in /incubator/harmony/enhanced/classlib/trunk/modules/print/src: main/java/common/javax/print/attribute/standard/ main/java/common/org/apache/harmony/x/print/ipp/util/ test/api/java/common/javax/print/attribute/standard/
Date Wed, 01 Nov 2006 03:58:09 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/JobStateReason.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/JobStateReason.java?view=diff&rev=469773&r1=469772&r2=469773
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/JobStateReason.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/JobStateReason.java Tue Oct 31 19:58:05 2006
@@ -14,10 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Elena V. Sayapina 
- * @version $Revision: 1.5 $ 
- */ 
 
 package javax.print.attribute.standard;
 
@@ -28,179 +24,99 @@
  * Table values are obtained from RFC2911: Internet Printing Protocol/1.1: 
  * Model and Semantics, section 4.3.8, http://ietf.org/rfc/rfc2911.txt?number=2911
  */
-
 public class JobStateReason extends EnumSyntax implements Attribute {
+    private static final long serialVersionUID = -8765894420449009168L;
+
+    public static final JobStateReason JOB_INCOMING = new JobStateReason(0);
+
+    public static final JobStateReason JOB_DATA_INSUFFICIENT = new JobStateReason(1);
+
+    public static final JobStateReason DOCUMENT_ACCESS_ERROR = new JobStateReason(2);
+
+    public static final JobStateReason SUBMISSION_INTERRUPTED = new JobStateReason(3);
+
+    public static final JobStateReason JOB_OUTGOING = new JobStateReason(4);
+
+    public static final JobStateReason JOB_HOLD_UNTIL_SPECIFIED = new JobStateReason(5);
+
+    public static final JobStateReason RESOURCES_ARE_NOT_READY = new JobStateReason(6);
+
+    public static final JobStateReason PRINTER_STOPPED_PARTLY = new JobStateReason(7);
+
+    public static final JobStateReason PRINTER_STOPPED = new JobStateReason(8);
+
+    public static final JobStateReason JOB_INTERPRETING = new JobStateReason(9);
+
+    public static final JobStateReason JOB_QUEUED = new JobStateReason(10);
+
+    public static final JobStateReason JOB_TRANSFORMING = new JobStateReason(11);
+
+    public static final JobStateReason JOB_QUEUED_FOR_MARKER = new JobStateReason(12);
+
+    public static final JobStateReason JOB_PRINTING = new JobStateReason(13);
 
+    public static final JobStateReason JOB_CANCELED_BY_USER = new JobStateReason(14);
 
-    public static final JobStateReason
-        JOB_INCOMING = new JobStateReason(0);
+    public static final JobStateReason JOB_CANCELED_BY_OPERATOR = new JobStateReason(15);
 
-    public static final JobStateReason
-        JOB_DATA_INSUFFICIENT = new JobStateReason(1);
+    public static final JobStateReason JOB_CANCELED_AT_DEVICE = new JobStateReason(16);
 
-    public static final JobStateReason
-        DOCUMENT_ACCESS_ERROR = new JobStateReason(2);
+    public static final JobStateReason ABORTED_BY_SYSTEM = new JobStateReason(17);
 
-    public static final JobStateReason
-        SUBMISSION_INTERRUPTED = new JobStateReason(3);
-
-    public static final JobStateReason
-        JOB_OUTGOING = new JobStateReason(4);
-
-    public static final JobStateReason
-        JOB_HOLD_UNTIL_SPECIFIED = new JobStateReason(5);
-
-    public static final JobStateReason
-        RESOURCES_ARE_NOT_READY = new JobStateReason(6);
-
-    public static final JobStateReason
-        PRINTER_STOPPED_PARTLY = new JobStateReason(7);
-
-    public static final JobStateReason
-        PRINTER_STOPPED = new JobStateReason(8);
-
-    public static final JobStateReason
-        JOB_INTERPRETING = new JobStateReason(9);
-
-    public static final JobStateReason
-        JOB_QUEUED = new JobStateReason(10);
-
-    public static final JobStateReason
-        JOB_TRANSFORMING = new JobStateReason(11);
-
-    public static final JobStateReason
-        JOB_QUEUED_FOR_MARKER = new JobStateReason(12);
-
-    public static final JobStateReason
-        JOB_PRINTING = new JobStateReason(13);
-
-    public static final JobStateReason
-        JOB_CANCELED_BY_USER = new JobStateReason(14);
-
-    public static final JobStateReason
-        JOB_CANCELED_BY_OPERATOR = new JobStateReason(15);
-
-    public static final JobStateReason
-        JOB_CANCELED_AT_DEVICE = new JobStateReason(16);
-
-    public static final JobStateReason
-        ABORTED_BY_SYSTEM = new JobStateReason(17);
-
-    public static final JobStateReason
-        UNSUPPORTED_COMPRESSION = new JobStateReason(18);
-
-    public static final JobStateReason
-        COMPRESSION_ERROR = new JobStateReason(19);
-
-    public static final JobStateReason
-        UNSUPPORTED_DOCUMENT_FORMAT = new JobStateReason(20);
-
-    public static final JobStateReason
-        DOCUMENT_FORMAT_ERROR = new JobStateReason(21);
-
-    public static final JobStateReason
-        PROCESSING_TO_STOP_POINT = new JobStateReason(22);
-
-    public static final JobStateReason
-        SERVICE_OFF_LINE = new JobStateReason(23);
-
-    public static final JobStateReason
-        JOB_COMPLETED_SUCCESSFULLY = new JobStateReason(24);
-
-    public static final JobStateReason
-        JOB_COMPLETED_WITH_WARNINGS = new JobStateReason(25);
-
-    public static final JobStateReason
-        JOB_COMPLETED_WITH_ERRORS = new JobStateReason(26);
-
-    public static final JobStateReason
-        JOB_RESTARTABLE = new JobStateReason(27);
-
-    public static final JobStateReason
-        QUEUED_IN_DEVICE = new JobStateReason(28);
-
-
-
-private static final JobStateReason[] enumValueTable = {
-
-        JOB_INCOMING,
-        JOB_DATA_INSUFFICIENT,
-        DOCUMENT_ACCESS_ERROR,
-        SUBMISSION_INTERRUPTED,
-        JOB_OUTGOING,
-        JOB_HOLD_UNTIL_SPECIFIED,
-        RESOURCES_ARE_NOT_READY,
-        PRINTER_STOPPED_PARTLY,
-        PRINTER_STOPPED,
-        JOB_INTERPRETING,
-        JOB_QUEUED,
-        JOB_TRANSFORMING,
-        JOB_QUEUED_FOR_MARKER,
-        JOB_PRINTING,
-        JOB_CANCELED_BY_USER,
-        JOB_CANCELED_BY_OPERATOR,
-        JOB_CANCELED_AT_DEVICE,
-        ABORTED_BY_SYSTEM,
-        UNSUPPORTED_COMPRESSION,
-        COMPRESSION_ERROR,
-        UNSUPPORTED_DOCUMENT_FORMAT,
-        DOCUMENT_FORMAT_ERROR,
-        PROCESSING_TO_STOP_POINT,
-        SERVICE_OFF_LINE,
-        JOB_COMPLETED_SUCCESSFULLY,
-        JOB_COMPLETED_WITH_WARNINGS,
-        JOB_COMPLETED_WITH_ERRORS,
-        JOB_RESTARTABLE,
-        QUEUED_IN_DEVICE
-
-    };
-
-    private static final String[] stringTable = {
-
-            "job-incoming",
-            "job-data-insufficient",
-            "document-access-error",
-            "submission-interrupted",
-            "job-outgoing",
-            "job-hold-until-specified",
-            "resources-are-not-ready",
-            "printer-stopped-partly",
-            "printer-stopped",
-            "job-interpreting",
-            "job-queued",
-            "job-transforming",
-            "job-queued-for-marker",
-            "job-printing",
-            "job-canceled-by-user",
-            "job-canceled-by-operator",
-            "job-canceled-at-device",
-            "aborted-by-system",
-            "unsupported-compression",
-            "compression-error",
-            "unsupported-document-format",
-            "document-format-error",
-            "processing-to-stop-point",
-            "service-off-line",
-            "job-completed-successfully",
-            "job-completed-with-warnings",
-            "job-completed-with-errors",
-            "job-restartable",
-            "queued-in-device"
-    };
+    public static final JobStateReason UNSUPPORTED_COMPRESSION = new JobStateReason(18);
 
+    public static final JobStateReason COMPRESSION_ERROR = new JobStateReason(19);
+
+    public static final JobStateReason UNSUPPORTED_DOCUMENT_FORMAT = new JobStateReason(20);
+
+    public static final JobStateReason DOCUMENT_FORMAT_ERROR = new JobStateReason(21);
+
+    public static final JobStateReason PROCESSING_TO_STOP_POINT = new JobStateReason(22);
+
+    public static final JobStateReason SERVICE_OFF_LINE = new JobStateReason(23);
+
+    public static final JobStateReason JOB_COMPLETED_SUCCESSFULLY = new JobStateReason(24);
+
+    public static final JobStateReason JOB_COMPLETED_WITH_WARNINGS = new JobStateReason(25);
+
+    public static final JobStateReason JOB_COMPLETED_WITH_ERRORS = new JobStateReason(26);
+
+    public static final JobStateReason JOB_RESTARTABLE = new JobStateReason(27);
+
+    public static final JobStateReason QUEUED_IN_DEVICE = new JobStateReason(28);
+
+    private static final JobStateReason[] enumValueTable = { JOB_INCOMING,
+            JOB_DATA_INSUFFICIENT, DOCUMENT_ACCESS_ERROR, SUBMISSION_INTERRUPTED, JOB_OUTGOING,
+            JOB_HOLD_UNTIL_SPECIFIED, RESOURCES_ARE_NOT_READY, PRINTER_STOPPED_PARTLY,
+            PRINTER_STOPPED, JOB_INTERPRETING, JOB_QUEUED, JOB_TRANSFORMING,
+            JOB_QUEUED_FOR_MARKER, JOB_PRINTING, JOB_CANCELED_BY_USER,
+            JOB_CANCELED_BY_OPERATOR, JOB_CANCELED_AT_DEVICE, ABORTED_BY_SYSTEM,
+            UNSUPPORTED_COMPRESSION, COMPRESSION_ERROR, UNSUPPORTED_DOCUMENT_FORMAT,
+            DOCUMENT_FORMAT_ERROR, PROCESSING_TO_STOP_POINT, SERVICE_OFF_LINE,
+            JOB_COMPLETED_SUCCESSFULLY, JOB_COMPLETED_WITH_WARNINGS, JOB_COMPLETED_WITH_ERRORS,
+            JOB_RESTARTABLE, QUEUED_IN_DEVICE };
+
+    private static final String[] stringTable = { "job-incoming", "job-data-insufficient",
+            "document-access-error", "submission-interrupted", "job-outgoing",
+            "job-hold-until-specified", "resources-are-not-ready", "printer-stopped-partly",
+            "printer-stopped", "job-interpreting", "job-queued", "job-transforming",
+            "job-queued-for-marker", "job-printing", "job-canceled-by-user",
+            "job-canceled-by-operator", "job-canceled-at-device", "aborted-by-system",
+            "unsupported-compression", "compression-error", "unsupported-document-format",
+            "document-format-error", "processing-to-stop-point", "service-off-line",
+            "job-completed-successfully", "job-completed-with-warnings",
+            "job-completed-with-errors", "job-restartable", "queued-in-device" };
 
     protected JobStateReason(int value) {
         super(value);
     }
 
-
+    @Override
     protected EnumSyntax[] getEnumValueTable() {
-        return (EnumSyntax[]) enumValueTable.clone();
+        return enumValueTable.clone();
     }
 
-    public final Class getCategory() {
-    /* 1.5 support requires the following changes
-       Class<? extends Attribute> getCategory() { */
+    public final Class<? extends Attribute> getCategory() {
         return JobStateReason.class;
     }
 
@@ -208,9 +124,8 @@
         return "job-state-reason";
     }
 
+    @Override
     protected String[] getStringTable() {
-        return (String[]) stringTable.clone();
+        return stringTable.clone();
     }
-
-
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/JobStateReasons.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/JobStateReasons.java?view=diff&rev=469773&r1=469772&r2=469773
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/JobStateReasons.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/JobStateReasons.java Tue Oct 31 19:58:05 2006
@@ -14,68 +14,49 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Elena V. Sayapina 
- * @version $Revision: 1.6 $ 
- */ 
 
 package javax.print.attribute.standard;
 
 import java.util.Collection;
 import java.util.HashSet;
-import java.util.Iterator;
-
+import javax.print.attribute.Attribute;
 import javax.print.attribute.PrintJobAttribute;
 
-public final class JobStateReasons extends HashSet implements PrintJobAttribute {
-//1.5 support requires the following changes 
-//public final class JobStateReasons extends HashSet<JobStateReason> 
-//implements PrintJobAttribute {
+public final class JobStateReasons extends HashSet<JobStateReason> implements PrintJobAttribute {
+    private static final long serialVersionUID = 8849088261264331812L;
 
     public JobStateReasons() {
         super();
     }
 
-    public JobStateReasons(Collection collection) {
-    //1.5 support requires the following changes 
-    //public JobStateReasons(Collection<JobStateReason> collection) {
-
-        this();
-        Iterator iterator = collection.iterator();
-        while (iterator.hasNext()) {
-            add(iterator.next());
+    public JobStateReasons(Collection<JobStateReason> collection) {
+        super();
+        for (JobStateReason reason : collection) {
+            add(reason);
         }
     }
 
     public JobStateReasons(int initialCapacity) {
         super(initialCapacity);
-
     }
 
     public JobStateReasons(int initialCapacity, float loadFactor) {
         super(initialCapacity, loadFactor);
     }
 
-
-    public boolean add(Object reason) {
-    //1.5 support requires the following changes 
-    //public boolean add(JobStateReason reason) {
-
+    @Override
+    public boolean add(JobStateReason reason) {
         if (reason == null) {
             throw new NullPointerException("Null JobStateReason");
         }
-        return super.add( (JobStateReason) reason);
+        return super.add(reason);
     }
 
-    public final Class getCategory() {
-    //1.5 support requires the following changes
-    //Class<? extends Attribute> getCategory() {
+    public final Class<? extends Attribute> getCategory() {
         return JobStateReasons.class;
     }
 
     public final String getName() {
         return "job-state-reasons";
     }
-
-
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/Media.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/Media.java?view=diff&rev=469773&r1=469772&r2=469773
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/Media.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/Media.java Tue Oct 31 19:58:05 2006
@@ -14,46 +14,35 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Elena V. Sayapina 
- * @version $Revision: 1.5 $ 
- */ 
 
 package javax.print.attribute.standard;
 
+import javax.print.attribute.Attribute;
 import javax.print.attribute.DocAttribute;
 import javax.print.attribute.EnumSyntax;
 import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
 
-public abstract class Media extends EnumSyntax 
-    implements DocAttribute, PrintJobAttribute, PrintRequestAttribute {
-
-
+public abstract class Media extends EnumSyntax implements DocAttribute, PrintJobAttribute,
+        PrintRequestAttribute {
     protected Media(int value) {
-           super(value);
+        super(value);
     }
 
-
-    public boolean equals (Object object) {
-
-        if ((object instanceof Media) &&
-                (object.getClass() == this.getClass()) &&
-                    ((Media)object).getValue() == this.getValue() ) {
+    @Override
+    public boolean equals(Object object) {
+        if ((object instanceof Media) && (object.getClass() == this.getClass())
+                && ((Media) object).getValue() == this.getValue()) {
             return true;
-        } else {
-            return false;
         }
+        return false;
     }
 
-    public final Class getCategory() {
-    /* 1.5 support requires the following changes
-       Class<? extends Attribute> getCategory() { */
+    public final Class<? extends Attribute> getCategory() {
         return Media.class;
     }
 
     public final String getName() {
         return "media";
     }
-
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MediaName.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MediaName.java?view=diff&rev=469773&r1=469772&r2=469773
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MediaName.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MediaName.java Tue Oct 31 19:58:05 2006
@@ -14,10 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Elena V. Sayapina 
- * @version $Revision: 1.4 $ 
- */ 
 
 package javax.print.attribute.standard;
 
@@ -28,9 +24,8 @@
  * Table values are obtained from RFC2911: Internet Printing Protocol/1.1: 
  * Model and Semantics, Appendix C, http://ietf.org/rfc/rfc2911.txt?number=2911
  */
-
 public class MediaName extends Media implements Attribute {
-
+    private static final long serialVersionUID = 4653117714524155448L;
 
     public static final MediaName NA_LETTER_WHITE = new MediaName(0);
 
@@ -40,30 +35,23 @@
 
     public static final MediaName ISO_A4_TRANSPARENT = new MediaName(3);
 
+    private static final MediaName[] enumValueTable = { NA_LETTER_WHITE, NA_LETTER_TRANSPARENT,
+            ISO_A4_WHITE, ISO_A4_TRANSPARENT };
 
-    private static final MediaName[] enumValueTable = { NA_LETTER_WHITE,
-                                                        NA_LETTER_TRANSPARENT,
-                                                        ISO_A4_WHITE,
-                                                        ISO_A4_TRANSPARENT };
-
-    private static final String[] stringTable = { "na-letter-white",
-                                                  "na-letter-transparent",
-                                                  "iso-a4-white",
-                                                  "iso-a4-transparent" };
-
+    private static final String[] stringTable = { "na-letter-white", "na-letter-transparent",
+            "iso-a4-white", "iso-a4-transparent" };
 
     protected MediaName(int value) {
         super(value);
     }
 
-
+    @Override
     protected EnumSyntax[] getEnumValueTable() {
-        return (EnumSyntax[]) enumValueTable.clone();
+        return enumValueTable.clone();
     }
 
+    @Override
     protected String[] getStringTable() {
-        return (String[]) stringTable.clone();
+        return stringTable.clone();
     }
-
-
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MediaPrintableArea.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MediaPrintableArea.java?view=diff&rev=469773&r1=469772&r2=469773
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MediaPrintableArea.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MediaPrintableArea.java Tue Oct 31 19:58:05 2006
@@ -14,134 +14,120 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Elena V. Sayapina 
- * @version $Revision: 1.5 $ 
- */ 
 
 package javax.print.attribute.standard;
 
+import javax.print.attribute.Attribute;
 import javax.print.attribute.DocAttribute;
 import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
 
-public final class MediaPrintableArea 
-    implements DocAttribute, PrintJobAttribute, PrintRequestAttribute {
-
+public final class MediaPrintableArea implements DocAttribute, PrintJobAttribute,
+        PrintRequestAttribute {
+    private static final long serialVersionUID = -1597171464050795793L;
 
     public static final int INCH = 25400;
 
     public static final int MM = 1000;
-    
-    private int x;
-    private int y;
-    private int width;
-    private int height;
-    private int units;
-    
-    public MediaPrintableArea(int x, int y, int width, int height, int units) {
 
-        if ((x < 0) || (y < 0) || (width <= 0) || (height <= 0) ||
-                                                                (units < 1)) {
+    private final int x;
+
+    private final int y;
+
+    private final int width;
+
+    private final int height;
+
+    public MediaPrintableArea(int x, int y, int width, int height, int units) {
+        if ((x < 0) || (y < 0) || (width <= 0) || (height <= 0) || (units < 1)) {
             throw new IllegalArgumentException("Valid values are: x >= 0, "
-                        + "y >= 0, width > 0, height > 0, units >= 1");
+                    + "y >= 0, width > 0, height > 0, units >= 1");
         }
-        this.x = x*units;
-        this.y = y*units;
-        this.width = width*units;
-        this.height = height*units;
+        this.x = x * units;
+        this.y = y * units;
+        this.width = width * units;
+        this.height = height * units;
     }
-    
-    public MediaPrintableArea(float x, float y, float width, float height, 
-                                                                   int units) {
-
-        if ((x < 0.0f) || (y < 0.0f) || (width <= 0.0f) || (height <= 0.0f) ||
-                (units < 1) ) {
 
-            throw new IllegalArgumentException("Valid values are: x >= 0.0, " +
-                            "y >= 0.0, width > 0.0, height > 0.0, units > 1");
-        }
-        this.x = Math.round(x*units);
-        this.y = Math.round(y*units);
-        this.width = Math.round(width*units);
-        this.height = Math.round(height*units);
+    public MediaPrintableArea(float x, float y, float width, float height, int units) {
+        if ((x < 0.0f) || (y < 0.0f) || (width <= 0.0f) || (height <= 0.0f) || (units < 1)) {
+            throw new IllegalArgumentException("Valid values are: x >= 0.0, "
+                    + "y >= 0.0, width > 0.0, height > 0.0, units > 1");
+        }
+        this.x = Math.round(x * units);
+        this.y = Math.round(y * units);
+        this.width = Math.round(width * units);
+        this.height = Math.round(height * units);
     }
 
-    
+    @Override
     public boolean equals(Object object) {
- 
         boolean outcome = false;
         if (object instanceof MediaPrintableArea) {
-           MediaPrintableArea mpArea = (MediaPrintableArea)object;
-           if ( (x == mpArea.x) &&  (y == mpArea.y) && 
-                    (width == mpArea.width) && (height == mpArea.height) ) {
-            outcome = true;
-           }   
+            MediaPrintableArea mpArea = (MediaPrintableArea) object;
+            if ((x == mpArea.x) && (y == mpArea.y) && (width == mpArea.width)
+                    && (height == mpArea.height)) {
+                outcome = true;
+            }
         }
         return outcome;
     }
-    
-    public final Class getCategory() {
-    /* 1.5 support requires the following changes 
-       Class<? extends Attribute> getCategory() { */
+
+    public final Class<? extends Attribute> getCategory() {
         return MediaPrintableArea.class;
     }
 
     public final String getName() {
         return "media-printable-area";
     }
-    
+
     public float getX(int units) {
         if (units < 1) {
             throw new IllegalArgumentException("units is less than 1");
         }
-        return ((float) x)/units;
-     }
+        return ((float) x) / units;
+    }
 
-     public float getY(int units) {
+    public float getY(int units) {
         if (units < 1) {
             throw new IllegalArgumentException("units is less than 1");
         }
-        return ((float) y)/units;
-     }
+        return ((float) y) / units;
+    }
 
-     public float getWidth(int units) {
+    public float getWidth(int units) {
         if (units < 1) {
             throw new IllegalArgumentException("units is less than 1");
         }
-        return ((float) width)/units;
-     }
+        return ((float) width) / units;
+    }
 
-     public float getHeight(int units) {
+    public float getHeight(int units) {
         if (units < 1) {
             throw new IllegalArgumentException("units is less than 1");
         }
-        return ((float) height)/units;
-     }
-     
-     public float[] getPrintableArea(int units) {
-         return new float[] { getX(units), 
-                             getY(units),
-                             getWidth(units), 
-                             getHeight(units) };
-     }
-
-     public int hashCode() { 
-         return ( (y+height) | ((x+width) << 16) );
-     }
-    
-     public String toString() {
-         return toString(MM, "mm");
-     }
-    
-     public String toString(int units, String unitsName) {
-         if (unitsName == null) {
-             unitsName = "";
-         }
-         float[] pa = getPrintableArea(units);
-         return ("x=" + pa[0] + " y=" + pa[1] + 
-                    " width=" + pa[2] + " height=" + pa[3] + " " + unitsName);
-     } 
+        return ((float) height) / units;
+    }
 
-   
+    public float[] getPrintableArea(int units) {
+        return new float[] { getX(units), getY(units), getWidth(units), getHeight(units) };
+    }
+
+    @Override
+    public int hashCode() {
+        return ((y + height) | ((x + width) << 16));
+    }
+
+    @Override
+    public String toString() {
+        return toString(MM, "mm");
+    }
+
+    public String toString(int units, String unitsName) {
+        if (unitsName == null) {
+            unitsName = "";
+        }
+        float[] pa = getPrintableArea(units);
+        return ("x=" + pa[0] + " y=" + pa[1] + " width=" + pa[2] + " height=" + pa[3] + " " + unitsName);
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MediaSize.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MediaSize.java?view=diff&rev=469773&r1=469772&r2=469773
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MediaSize.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MediaSize.java Tue Oct 31 19:58:05 2006
@@ -14,384 +14,319 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Elena V. Sayapina 
- * @version $Revision: 1.5 $ 
- */ 
 
 package javax.print.attribute.standard;
 
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
-
+import java.util.List;
+import java.util.Map;
 import javax.print.attribute.Attribute;
 import javax.print.attribute.Size2DSyntax;
 
 public class MediaSize extends Size2DSyntax implements Attribute {
+    private static final long serialVersionUID = -1967958664615414771L;
 
+    private static final List<MediaSize> sizesList = new ArrayList<MediaSize>(80);
 
-    private MediaSizeName mediaSizeName;
-    private static ArrayList sizesList = new ArrayList(80);
-    private static HashMap mediaSizeMap = new HashMap(80, 1);
-
+    private static final Map<MediaSizeName, MediaSize> mediaSizeMap = new HashMap<MediaSizeName, MediaSize>(
+            80, 1);
 
     public static final class Engineering {
-
         private Engineering() {
-
+            super();
         }
 
-        public static final MediaSize
-            A = new MediaSize(8.5f, 11.0f, Size2DSyntax.INCH, MediaSizeName.A);
-
-        public static final MediaSize
-            B = new MediaSize(11, 17, Size2DSyntax.INCH, MediaSizeName.B);
+        public static final MediaSize A = new MediaSize(8.5f, 11.0f, Size2DSyntax.INCH,
+                MediaSizeName.A);
 
-        public static final MediaSize
-            C = new MediaSize(17, 22, Size2DSyntax.INCH, MediaSizeName.C);
+        public static final MediaSize B = new MediaSize(11, 17, Size2DSyntax.INCH,
+                MediaSizeName.B);
 
-        public static final MediaSize
-            D = new MediaSize(22, 34, Size2DSyntax.INCH, MediaSizeName.D);
+        public static final MediaSize C = new MediaSize(17, 22, Size2DSyntax.INCH,
+                MediaSizeName.C);
 
-        public static final MediaSize
-            E = new MediaSize(34, 44, Size2DSyntax.INCH, MediaSizeName.E);
+        public static final MediaSize D = new MediaSize(22, 34, Size2DSyntax.INCH,
+                MediaSizeName.D);
 
+        public static final MediaSize E = new MediaSize(34, 44, Size2DSyntax.INCH,
+                MediaSizeName.E);
     }
 
     public static final class ISO {
-
         private ISO() {
-
+            super();
         }
 
-        public static final MediaSize
-            A0 = new MediaSize(841, 1189, Size2DSyntax.MM, MediaSizeName.ISO_A0);
+        public static final MediaSize A0 = new MediaSize(841, 1189, Size2DSyntax.MM,
+                MediaSizeName.ISO_A0);
 
-        public static final MediaSize
-            A1 = new MediaSize(594, 841, Size2DSyntax.MM, MediaSizeName.ISO_A1);
+        public static final MediaSize A1 = new MediaSize(594, 841, Size2DSyntax.MM,
+                MediaSizeName.ISO_A1);
 
-        public static final MediaSize
-            A2 = new MediaSize(420, 594, Size2DSyntax.MM, MediaSizeName.ISO_A2);
+        public static final MediaSize A2 = new MediaSize(420, 594, Size2DSyntax.MM,
+                MediaSizeName.ISO_A2);
 
-        public static final MediaSize
-            A3 = new MediaSize(297, 420, Size2DSyntax.MM, MediaSizeName.ISO_A3);
+        public static final MediaSize A3 = new MediaSize(297, 420, Size2DSyntax.MM,
+                MediaSizeName.ISO_A3);
 
-        public static final MediaSize
-            A4 = new MediaSize(210, 297, Size2DSyntax.MM, MediaSizeName.ISO_A4);
+        public static final MediaSize A4 = new MediaSize(210, 297, Size2DSyntax.MM,
+                MediaSizeName.ISO_A4);
 
-        public static final MediaSize
-            A5 = new MediaSize(148, 210, Size2DSyntax.MM, MediaSizeName.ISO_A5);
+        public static final MediaSize A5 = new MediaSize(148, 210, Size2DSyntax.MM,
+                MediaSizeName.ISO_A5);
 
-        public static final MediaSize
-            A6 = new MediaSize(105, 148, Size2DSyntax.MM, MediaSizeName.ISO_A6);
+        public static final MediaSize A6 = new MediaSize(105, 148, Size2DSyntax.MM,
+                MediaSizeName.ISO_A6);
 
-        public static final MediaSize
-            A7 = new MediaSize(74, 105, Size2DSyntax.MM, MediaSizeName.ISO_A7);
+        public static final MediaSize A7 = new MediaSize(74, 105, Size2DSyntax.MM,
+                MediaSizeName.ISO_A7);
 
-        public static final MediaSize
-            A8 = new MediaSize(52, 74, Size2DSyntax.MM, MediaSizeName.ISO_A8);
+        public static final MediaSize A8 = new MediaSize(52, 74, Size2DSyntax.MM,
+                MediaSizeName.ISO_A8);
 
-        public static final MediaSize
-            A9 = new MediaSize(37, 52, Size2DSyntax.MM, MediaSizeName.ISO_A9);
+        public static final MediaSize A9 = new MediaSize(37, 52, Size2DSyntax.MM,
+                MediaSizeName.ISO_A9);
 
-        public static final MediaSize
-            A10 = new MediaSize(26, 37, Size2DSyntax.MM, MediaSizeName.ISO_A10);
+        public static final MediaSize A10 = new MediaSize(26, 37, Size2DSyntax.MM,
+                MediaSizeName.ISO_A10);
 
-        public static final MediaSize
-            B0 = new MediaSize(1000, 1414, Size2DSyntax.MM, MediaSizeName.ISO_B0);
+        public static final MediaSize B0 = new MediaSize(1000, 1414, Size2DSyntax.MM,
+                MediaSizeName.ISO_B0);
 
-        public static final MediaSize
-            B1 = new MediaSize(707, 1000, Size2DSyntax.MM, MediaSizeName.ISO_B1);
+        public static final MediaSize B1 = new MediaSize(707, 1000, Size2DSyntax.MM,
+                MediaSizeName.ISO_B1);
 
-        public static final MediaSize
-            B2 = new MediaSize(500, 707, Size2DSyntax.MM, MediaSizeName.ISO_B2);
+        public static final MediaSize B2 = new MediaSize(500, 707, Size2DSyntax.MM,
+                MediaSizeName.ISO_B2);
 
-        public static final MediaSize
-            B3 = new MediaSize(353, 500, Size2DSyntax.MM, MediaSizeName.ISO_B3);
+        public static final MediaSize B3 = new MediaSize(353, 500, Size2DSyntax.MM,
+                MediaSizeName.ISO_B3);
 
-        public static final MediaSize
-            B4 = new MediaSize(250, 353, Size2DSyntax.MM, MediaSizeName.ISO_B4);
+        public static final MediaSize B4 = new MediaSize(250, 353, Size2DSyntax.MM,
+                MediaSizeName.ISO_B4);
 
-        public static final MediaSize
-            B5 = new MediaSize(176, 250, Size2DSyntax.MM, MediaSizeName.ISO_B5);
+        public static final MediaSize B5 = new MediaSize(176, 250, Size2DSyntax.MM,
+                MediaSizeName.ISO_B5);
 
-        public static final MediaSize
-            B6 = new MediaSize(125, 176, Size2DSyntax.MM, MediaSizeName.ISO_B6);
+        public static final MediaSize B6 = new MediaSize(125, 176, Size2DSyntax.MM,
+                MediaSizeName.ISO_B6);
 
-        public static final MediaSize
-            B7 = new MediaSize(88, 125, Size2DSyntax.MM, MediaSizeName.ISO_B7);
+        public static final MediaSize B7 = new MediaSize(88, 125, Size2DSyntax.MM,
+                MediaSizeName.ISO_B7);
 
-        public static final MediaSize
-            B8 = new MediaSize(62, 88, Size2DSyntax.MM, MediaSizeName.ISO_B8);
+        public static final MediaSize B8 = new MediaSize(62, 88, Size2DSyntax.MM,
+                MediaSizeName.ISO_B8);
 
-        public static final MediaSize
-            B9 = new MediaSize(44, 62, Size2DSyntax.MM, MediaSizeName.ISO_B9);
+        public static final MediaSize B9 = new MediaSize(44, 62, Size2DSyntax.MM,
+                MediaSizeName.ISO_B9);
 
-        public static final MediaSize
-            B10 = new MediaSize(31, 44, Size2DSyntax.MM, MediaSizeName.ISO_B10);
+        public static final MediaSize B10 = new MediaSize(31, 44, Size2DSyntax.MM,
+                MediaSizeName.ISO_B10);
 
-        public static final MediaSize
-            C3 = new MediaSize(324, 458, Size2DSyntax.MM, MediaSizeName.ISO_C3);
+        public static final MediaSize C3 = new MediaSize(324, 458, Size2DSyntax.MM,
+                MediaSizeName.ISO_C3);
 
-        public static final MediaSize
-            C4 = new MediaSize(229, 324, Size2DSyntax.MM, MediaSizeName.ISO_C4);
+        public static final MediaSize C4 = new MediaSize(229, 324, Size2DSyntax.MM,
+                MediaSizeName.ISO_C4);
 
-        public static final MediaSize
-            C5 = new MediaSize(162, 229, Size2DSyntax.MM, MediaSizeName.ISO_C5);
+        public static final MediaSize C5 = new MediaSize(162, 229, Size2DSyntax.MM,
+                MediaSizeName.ISO_C5);
 
-        public static final MediaSize
-            C6 = new MediaSize(114, 162, Size2DSyntax.MM, MediaSizeName.ISO_C6);
+        public static final MediaSize C6 = new MediaSize(114, 162, Size2DSyntax.MM,
+                MediaSizeName.ISO_C6);
 
-        public static final MediaSize
-            DESIGNATED_LONG = new MediaSize(110, 220,
+        public static final MediaSize DESIGNATED_LONG = new MediaSize(110, 220,
                 Size2DSyntax.MM, MediaSizeName.ISO_DESIGNATED_LONG);
     }
 
     public static final class JIS {
-
         private JIS() {
-
+            super();
         }
 
-        public static final MediaSize
-            B0 = new MediaSize(1030, 1456, Size2DSyntax.MM, MediaSizeName.JIS_B0);
-
-        public static final MediaSize
-            B1 = new MediaSize(728, 1030, Size2DSyntax.MM, MediaSizeName.JIS_B1);
+        public static final MediaSize B0 = new MediaSize(1030, 1456, Size2DSyntax.MM,
+                MediaSizeName.JIS_B0);
 
-        public static final MediaSize
-            B2 = new MediaSize(515, 728, Size2DSyntax.MM, MediaSizeName.JIS_B2);
+        public static final MediaSize B1 = new MediaSize(728, 1030, Size2DSyntax.MM,
+                MediaSizeName.JIS_B1);
 
-        public static final MediaSize
-            B3 = new MediaSize(364, 515, Size2DSyntax.MM, MediaSizeName.JIS_B3);
+        public static final MediaSize B2 = new MediaSize(515, 728, Size2DSyntax.MM,
+                MediaSizeName.JIS_B2);
 
-        public static final MediaSize
-            B4 = new MediaSize(257, 364, Size2DSyntax.MM, MediaSizeName.JIS_B4);
+        public static final MediaSize B3 = new MediaSize(364, 515, Size2DSyntax.MM,
+                MediaSizeName.JIS_B3);
 
-        public static final MediaSize
-            B5 = new MediaSize(182, 257, Size2DSyntax.MM, MediaSizeName.JIS_B5);
+        public static final MediaSize B4 = new MediaSize(257, 364, Size2DSyntax.MM,
+                MediaSizeName.JIS_B4);
 
-        public static final MediaSize
-            B6 = new MediaSize(128, 182, Size2DSyntax.MM, MediaSizeName.JIS_B6);
+        public static final MediaSize B5 = new MediaSize(182, 257, Size2DSyntax.MM,
+                MediaSizeName.JIS_B5);
 
-        public static final MediaSize
-            B7 = new MediaSize(91, 128, Size2DSyntax.MM, MediaSizeName.JIS_B7);
+        public static final MediaSize B6 = new MediaSize(128, 182, Size2DSyntax.MM,
+                MediaSizeName.JIS_B6);
 
-        public static final MediaSize
-            B8 = new MediaSize(64, 91, Size2DSyntax.MM, MediaSizeName.JIS_B8);
+        public static final MediaSize B7 = new MediaSize(91, 128, Size2DSyntax.MM,
+                MediaSizeName.JIS_B7);
 
-        public static final MediaSize
-            B9 = new MediaSize(45, 64, Size2DSyntax.MM, MediaSizeName.JIS_B9);
+        public static final MediaSize B8 = new MediaSize(64, 91, Size2DSyntax.MM,
+                MediaSizeName.JIS_B8);
 
-        public static final MediaSize
-            B10 = new MediaSize(32, 45, Size2DSyntax.MM, MediaSizeName.JIS_B10);
+        public static final MediaSize B9 = new MediaSize(45, 64, Size2DSyntax.MM,
+                MediaSizeName.JIS_B9);
 
-        public static final MediaSize
-            CHOU_1 = new MediaSize(142, 332, Size2DSyntax.MM);
+        public static final MediaSize B10 = new MediaSize(32, 45, Size2DSyntax.MM,
+                MediaSizeName.JIS_B10);
 
-        public static final MediaSize
-            CHOU_2 = new MediaSize(119, 277, Size2DSyntax.MM);
+        public static final MediaSize CHOU_1 = new MediaSize(142, 332, Size2DSyntax.MM);
 
-        public static final MediaSize
-            CHOU_3 = new MediaSize(120, 235, Size2DSyntax.MM);
+        public static final MediaSize CHOU_2 = new MediaSize(119, 277, Size2DSyntax.MM);
 
-        public static final MediaSize
-            CHOU_4 = new MediaSize(90, 205, Size2DSyntax.MM);
+        public static final MediaSize CHOU_3 = new MediaSize(120, 235, Size2DSyntax.MM);
 
-        public static final MediaSize
-            CHOU_30 = new MediaSize(92, 235, Size2DSyntax.MM);
+        public static final MediaSize CHOU_4 = new MediaSize(90, 205, Size2DSyntax.MM);
 
-        public static final MediaSize
-            CHOU_40 = new MediaSize(90, 225, Size2DSyntax.MM);
+        public static final MediaSize CHOU_30 = new MediaSize(92, 235, Size2DSyntax.MM);
 
-        public static final MediaSize
-            KAKU_0 = new MediaSize(287, 382, Size2DSyntax.MM);
+        public static final MediaSize CHOU_40 = new MediaSize(90, 225, Size2DSyntax.MM);
 
-        public static final MediaSize
-            KAKU_1 = new MediaSize(270, 382, Size2DSyntax.MM);
+        public static final MediaSize KAKU_0 = new MediaSize(287, 382, Size2DSyntax.MM);
 
-        public static final MediaSize
-            KAKU_2 = new MediaSize(240, 332, Size2DSyntax.MM);
+        public static final MediaSize KAKU_1 = new MediaSize(270, 382, Size2DSyntax.MM);
 
-        public static final MediaSize
-            KAKU_3 = new MediaSize(216, 277, Size2DSyntax.MM);
+        public static final MediaSize KAKU_2 = new MediaSize(240, 332, Size2DSyntax.MM);
 
-        public static final MediaSize
-            KAKU_4 = new MediaSize(197, 267, Size2DSyntax.MM);
+        public static final MediaSize KAKU_3 = new MediaSize(216, 277, Size2DSyntax.MM);
 
-        public static final MediaSize
-            KAKU_5 = new MediaSize(190, 240, Size2DSyntax.MM);
+        public static final MediaSize KAKU_4 = new MediaSize(197, 267, Size2DSyntax.MM);
 
-        public static final MediaSize
-            KAKU_6 = new MediaSize(162, 229, Size2DSyntax.MM);
+        public static final MediaSize KAKU_5 = new MediaSize(190, 240, Size2DSyntax.MM);
 
-        public static final MediaSize
-            KAKU_7 = new MediaSize(142, 205, Size2DSyntax.MM);
+        public static final MediaSize KAKU_6 = new MediaSize(162, 229, Size2DSyntax.MM);
 
-        public static final MediaSize
-            KAKU_8 = new MediaSize(119, 197, Size2DSyntax.MM);
+        public static final MediaSize KAKU_7 = new MediaSize(142, 205, Size2DSyntax.MM);
 
-        public static final MediaSize
-            KAKU_20 = new MediaSize(229, 324, Size2DSyntax.MM);
+        public static final MediaSize KAKU_8 = new MediaSize(119, 197, Size2DSyntax.MM);
 
-        public static final MediaSize
-            KAKU_A4 = new MediaSize(228, 312, Size2DSyntax.MM);
+        public static final MediaSize KAKU_20 = new MediaSize(229, 324, Size2DSyntax.MM);
 
-        public static final MediaSize
-            YOU_1 = new MediaSize(120, 176, Size2DSyntax.MM);
+        public static final MediaSize KAKU_A4 = new MediaSize(228, 312, Size2DSyntax.MM);
 
-        public static final MediaSize
-            YOU_2 = new MediaSize(114, 162, Size2DSyntax.MM);
+        public static final MediaSize YOU_1 = new MediaSize(120, 176, Size2DSyntax.MM);
 
-        public static final MediaSize
-            YOU_3 = new MediaSize(98, 148, Size2DSyntax.MM);
+        public static final MediaSize YOU_2 = new MediaSize(114, 162, Size2DSyntax.MM);
 
-        public static final MediaSize
-            YOU_4 = new MediaSize(105, 235, Size2DSyntax.MM);
+        public static final MediaSize YOU_3 = new MediaSize(98, 148, Size2DSyntax.MM);
 
-        public static final MediaSize
-            YOU_5 = new MediaSize(95, 217, Size2DSyntax.MM);
+        public static final MediaSize YOU_4 = new MediaSize(105, 235, Size2DSyntax.MM);
 
-        public static final MediaSize
-            YOU_6 = new MediaSize(98, 190, Size2DSyntax.MM);
+        public static final MediaSize YOU_5 = new MediaSize(95, 217, Size2DSyntax.MM);
 
-        public static final MediaSize
-            YOU_7 = new MediaSize(92, 165, Size2DSyntax.MM);
+        public static final MediaSize YOU_6 = new MediaSize(98, 190, Size2DSyntax.MM);
 
+        public static final MediaSize YOU_7 = new MediaSize(92, 165, Size2DSyntax.MM);
     }
 
     public static final class NA {
-
         private NA() {
-
+            super();
         }
 
-        public static final MediaSize
-            LETTER = new MediaSize(8.5f, 11.0f,
-                Size2DSyntax.INCH, MediaSizeName.NA_LETTER);
-
-        public static final MediaSize
-            LEGAL = new MediaSize(8.5f, 14.0f,
-                Size2DSyntax.INCH, MediaSizeName.NA_LEGAL);
-
-        public static final MediaSize
-            NA_5X7 = new MediaSize(5, 7,
-                Size2DSyntax.INCH, MediaSizeName.NA_5X7);
-
-        public static final MediaSize
-            NA_8X10 = new MediaSize(8, 10,
-                Size2DSyntax.INCH, MediaSizeName.NA_8X10);
+        public static final MediaSize LETTER = new MediaSize(8.5f, 11.0f, Size2DSyntax.INCH,
+                MediaSizeName.NA_LETTER);
+
+        public static final MediaSize LEGAL = new MediaSize(8.5f, 14.0f, Size2DSyntax.INCH,
+                MediaSizeName.NA_LEGAL);
+
+        public static final MediaSize NA_5X7 = new MediaSize(5, 7, Size2DSyntax.INCH,
+                MediaSizeName.NA_5X7);
+
+        public static final MediaSize NA_8X10 = new MediaSize(8, 10, Size2DSyntax.INCH,
+                MediaSizeName.NA_8X10);
 
-        public static final MediaSize
-            NA_NUMBER_9_ENVELOPE = new MediaSize(3.875f, 8.875f,
+        public static final MediaSize NA_NUMBER_9_ENVELOPE = new MediaSize(3.875f, 8.875f,
                 Size2DSyntax.INCH, MediaSizeName.NA_NUMBER_9_ENVELOPE);
 
-        public static final MediaSize
-            NA_NUMBER_10_ENVELOPE = new MediaSize(4.125f, 9.5f,
+        public static final MediaSize NA_NUMBER_10_ENVELOPE = new MediaSize(4.125f, 9.5f,
                 Size2DSyntax.INCH, MediaSizeName.NA_NUMBER_10_ENVELOPE);
 
-        public static final MediaSize
-            NA_NUMBER_11_ENVELOPE = new MediaSize(4.5f, 10.375f,
+        public static final MediaSize NA_NUMBER_11_ENVELOPE = new MediaSize(4.5f, 10.375f,
                 Size2DSyntax.INCH, MediaSizeName.NA_NUMBER_11_ENVELOPE);
 
-        public static final MediaSize
-            NA_NUMBER_12_ENVELOPE = new MediaSize(4.75f, 11.0f,
+        public static final MediaSize NA_NUMBER_12_ENVELOPE = new MediaSize(4.75f, 11.0f,
                 Size2DSyntax.INCH, MediaSizeName.NA_NUMBER_12_ENVELOPE);
 
-        public static final MediaSize
-            NA_NUMBER_14_ENVELOPE = new MediaSize(5.0f, 11.5f,
+        public static final MediaSize NA_NUMBER_14_ENVELOPE = new MediaSize(5.0f, 11.5f,
                 Size2DSyntax.INCH, MediaSizeName.NA_NUMBER_14_ENVELOPE);
 
-        public static final MediaSize
-            NA_6X9_ENVELOPE = new MediaSize(6, 9,
-                Size2DSyntax.INCH, MediaSizeName.NA_6X9_ENVELOPE);
-
-        public static final MediaSize
-            NA_7X9_ENVELOPE = new MediaSize(7, 9,
-                Size2DSyntax.INCH, MediaSizeName.NA_7X9_ENVELOPE);
+        public static final MediaSize NA_6X9_ENVELOPE = new MediaSize(6, 9, Size2DSyntax.INCH,
+                MediaSizeName.NA_6X9_ENVELOPE);
 
-        public static final MediaSize
-            NA_9x11_ENVELOPE = new MediaSize(9, 11,
+        public static final MediaSize NA_7X9_ENVELOPE = new MediaSize(7, 9, Size2DSyntax.INCH,
+                MediaSizeName.NA_7X9_ENVELOPE);
+
+        public static final MediaSize NA_9x11_ENVELOPE = new MediaSize(9, 11,
                 Size2DSyntax.INCH, MediaSizeName.NA_9X11_ENVELOPE);
 
-        public static final MediaSize
-            NA_9x12_ENVELOPE = new MediaSize(9, 12,
+        public static final MediaSize NA_9x12_ENVELOPE = new MediaSize(9, 12,
                 Size2DSyntax.INCH, MediaSizeName.NA_9X12_ENVELOPE);
 
-        public static final MediaSize
-            NA_10x13_ENVELOPE = new MediaSize(10, 13,
+        public static final MediaSize NA_10x13_ENVELOPE = new MediaSize(10, 13,
                 Size2DSyntax.INCH, MediaSizeName.NA_10X13_ENVELOPE);
 
-        public static final MediaSize
-            NA_10x14_ENVELOPE = new MediaSize(10, 14,
+        public static final MediaSize NA_10x14_ENVELOPE = new MediaSize(10, 14,
                 Size2DSyntax.INCH, MediaSizeName.NA_10X14_ENVELOPE);
 
-        public static final MediaSize
-            NA_10X15_ENVELOPE = new MediaSize(10, 15,
+        public static final MediaSize NA_10X15_ENVELOPE = new MediaSize(10, 15,
                 Size2DSyntax.INCH, MediaSizeName.NA_10X15_ENVELOPE);
-
     }
 
     public static final class Other {
-
         private Other() {
-
+            super();
         }
 
-        public static final MediaSize
-            EXECUTIVE = new MediaSize(7.25f, 10.5f,
+        public static final MediaSize EXECUTIVE = new MediaSize(7.25f, 10.5f,
                 Size2DSyntax.INCH, MediaSizeName.EXECUTIVE);
 
-        public static final MediaSize
-            LEDGER = new MediaSize(11, 17,
-                Size2DSyntax.INCH, MediaSizeName.LEDGER);
-
-        public static final MediaSize
-            TABLOID = new MediaSize(11, 17,
-                Size2DSyntax.INCH, MediaSizeName.TABLOID);
-
-        public static final MediaSize
-            INVOICE = new MediaSize(5.5f, 8.5f,
-                Size2DSyntax.INCH, MediaSizeName.INVOICE);
-
-        public static final MediaSize
-            FOLIO = new MediaSize(8.5f, 13.0f,
-                Size2DSyntax.INCH, MediaSizeName.FOLIO);
-
-        public static final MediaSize
-            QUARTO = new MediaSize(8.5f, 10.83f,
-                Size2DSyntax.INCH, MediaSizeName.QUARTO);
-
-        public static final MediaSize
-            ITALY_ENVELOPE = new MediaSize(110, 230,
-                Size2DSyntax.MM, MediaSizeName.ITALY_ENVELOPE);
+        public static final MediaSize LEDGER = new MediaSize(11, 17, Size2DSyntax.INCH,
+                MediaSizeName.LEDGER);
+
+        public static final MediaSize TABLOID = new MediaSize(11, 17, Size2DSyntax.INCH,
+                MediaSizeName.TABLOID);
 
-        public static final MediaSize
-            MONARCH_ENVELOPE = new MediaSize(3.87f, 7.5f,
+        public static final MediaSize INVOICE = new MediaSize(5.5f, 8.5f, Size2DSyntax.INCH,
+                MediaSizeName.INVOICE);
+
+        public static final MediaSize FOLIO = new MediaSize(8.5f, 13.0f, Size2DSyntax.INCH,
+                MediaSizeName.FOLIO);
+
+        public static final MediaSize QUARTO = new MediaSize(8.5f, 10.83f, Size2DSyntax.INCH,
+                MediaSizeName.QUARTO);
+
+        public static final MediaSize ITALY_ENVELOPE = new MediaSize(110, 230, Size2DSyntax.MM,
+                MediaSizeName.ITALY_ENVELOPE);
+
+        public static final MediaSize MONARCH_ENVELOPE = new MediaSize(3.87f, 7.5f,
                 Size2DSyntax.INCH, MediaSizeName.MONARCH_ENVELOPE);
 
-        public static final MediaSize
-            PERSONAL_ENVELOPE = new MediaSize(3.625f, 6.5f,
+        public static final MediaSize PERSONAL_ENVELOPE = new MediaSize(3.625f, 6.5f,
                 Size2DSyntax.INCH, MediaSizeName.PERSONAL_ENVELOPE);
 
-        public static final MediaSize
-            JAPANESE_POSTCARD = new MediaSize(100, 148,
+        public static final MediaSize JAPANESE_POSTCARD = new MediaSize(100, 148,
                 Size2DSyntax.MM, MediaSizeName.JAPANESE_POSTCARD);
 
-        public static final MediaSize
-            JAPANESE_DOUBLE_POSTCARD = new MediaSize(148, 200,
+        public static final MediaSize JAPANESE_DOUBLE_POSTCARD = new MediaSize(148, 200,
                 Size2DSyntax.MM, MediaSizeName.JAPANESE_DOUBLE_POSTCARD);
-
-
     }
 
-
     /*
      * Loading nested classes and initializing it's static fields.
      * It is necessary to put MediaSize instances into ArrayList
      * and HashMap used in static MediaSize methods.
      */
+    //TODO This comment and code need to be validated; this seems unnecessary
     static {
         MediaSize initClass = MediaSize.Engineering.A;
         initClass = MediaSize.ISO.A0;
@@ -400,13 +335,16 @@
         initClass = MediaSize.Other.EXECUTIVE;
     }
 
+    private MediaSizeName mediaSizeName;
 
     public MediaSize(int x, int y, int units) {
         super(x, y, units);
         if (x > y) {
             throw new IllegalArgumentException("x > y");
         }
-        sizesList.add(this);
+        synchronized (MediaSize.class) {
+            sizesList.add(this);
+        }
     }
 
     public MediaSize(float x, float y, int units) {
@@ -414,7 +352,9 @@
         if (x > y) {
             throw new IllegalArgumentException("x > y");
         }
-        sizesList.add(this);
+        synchronized (MediaSize.class) {
+            sizesList.add(this);
+        }
     }
 
     public MediaSize(int x, int y, int units, MediaSizeName mediaSizeName) {
@@ -423,67 +363,71 @@
             throw new IllegalArgumentException("x > y");
         }
         this.mediaSizeName = mediaSizeName;
-        sizesList.add(this);
-        mediaSizeMap.put(mediaSizeName, this);
+        synchronized (MediaSize.class) {
+            sizesList.add(this);
+            mediaSizeMap.put(mediaSizeName, this);
+        }
     }
 
-    public MediaSize(float x, float y,int units, MediaSizeName mediaSizeName) {
+    public MediaSize(float x, float y, int units, MediaSizeName mediaSizeName) {
         super(x, y, units);
         if (x > y) {
             throw new IllegalArgumentException("x > y");
         }
         this.mediaSizeName = mediaSizeName;
-        sizesList.add(this);
-        mediaSizeMap.put(mediaSizeName, this);
+        synchronized (MediaSize.class) {
+            sizesList.add(this);
+            mediaSizeMap.put(mediaSizeName, this);
+        }
     }
 
+    @Override
     public boolean equals(Object object) {
-        if ( !(object instanceof MediaSize ) ) {
+        if (!(object instanceof MediaSize)) {
             return false;
         }
         return super.equals(object);
     }
 
     public static MediaSizeName findMedia(float x, float y, int units) {
-
-        if ( (x <= 0.0) || (y <= 0.0) || (units < 1) ) {
-            throw new IllegalArgumentException("Valid values are: " +
-                                            "x > 0, y > 0, units >= 1");
-        }
-        MediaSize hit = null;
-        double curX, curY, curDif;
-        double difference = Double.MAX_VALUE;
-        Iterator i = sizesList.iterator();
-        while (i.hasNext()) {
-            MediaSize mediaSize = (MediaSize) i.next();
-            curX = mediaSize.getX(units);
-            curY = mediaSize.getY(units);
-            if ( (x == curX) && (y == curY) ) {
-                hit = mediaSize;
-                break;
-            } else {
-                curDif = curX*curX - 2*x*curX - 2*y*curY + curY*curY;
-                if (curDif <= difference){
+        if ((x <= 0.0) || (y <= 0.0) || (units < 1)) {
+            throw new IllegalArgumentException("Valid values are: "
+                    + "x > 0, y > 0, units >= 1");
+        }
+        synchronized (MediaSize.class) {
+            MediaSize hit = null;
+            double curX, curY, curDif;
+            double difference = Double.MAX_VALUE;
+            Iterator<MediaSize> i = sizesList.iterator();
+            while (i.hasNext()) {
+                MediaSize mediaSize = i.next();
+                curX = mediaSize.getX(units);
+                curY = mediaSize.getY(units);
+                if ((x == curX) && (y == curY)) {
+                    hit = mediaSize;
+                    break;
+                }
+                curDif = curX * curX - 2 * x * curX - 2 * y * curY + curY * curY;
+                if (curDif <= difference) {
                     difference = curDif;
                     hit = mediaSize;
                 }
             }
-        }
-        if (hit != null) {
-            return hit.getMediaSizeName();
-        } else {
+            if (hit != null) {
+                return hit.getMediaSizeName();
+            }
             return null;
         }
     }
 
-    public final Class getCategory() {
-    /* 1.5 support requires the following changes
-       Class<? extends Attribute> getCategory() { */
+    public final Class<? extends Attribute> getCategory() {
         return MediaSize.class;
     }
 
     public static MediaSize getMediaSizeForName(MediaSizeName mediaSizeName) {
-        return (MediaSize) mediaSizeMap.get(mediaSizeName);
+        synchronized (MediaSize.class) {
+            return mediaSizeMap.get(mediaSizeName);
+        }
     }
 
     public MediaSizeName getMediaSizeName() {
@@ -493,6 +437,4 @@
     public final String getName() {
         return "media-size";
     }
-
-
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MediaSizeName.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MediaSizeName.java?view=diff&rev=469773&r1=469772&r2=469773
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MediaSizeName.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MediaSizeName.java Tue Oct 31 19:58:05 2006
@@ -14,10 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Elena V. Sayapina 
- * @version $Revision: 1.4 $ 
- */ 
 
 package javax.print.attribute.standard;
 
@@ -27,90 +23,89 @@
  * Table values are obtained from RFC2911: Internet Printing Protocol/1.1: 
  * Model and Semantics, Appendix C, http://ietf.org/rfc/rfc2911.txt?number=2911
  */
-
 public class MediaSizeName extends Media {
-
+    private static final long serialVersionUID = 2778798329756942747L;
 
     public static final MediaSizeName ISO_A0 = new MediaSizeName(0);
-   
+
     public static final MediaSizeName ISO_A1 = new MediaSizeName(1);
-    
+
     public static final MediaSizeName ISO_A2 = new MediaSizeName(2);
-    
+
     public static final MediaSizeName ISO_A3 = new MediaSizeName(3);
-    
+
     public static final MediaSizeName ISO_A4 = new MediaSizeName(4);
-    
+
     public static final MediaSizeName ISO_A5 = new MediaSizeName(5);
-   
+
     public static final MediaSizeName ISO_A6 = new MediaSizeName(6);
-    
+
     public static final MediaSizeName ISO_A7 = new MediaSizeName(7);
-    
+
     public static final MediaSizeName ISO_A8 = new MediaSizeName(8);
-    
+
     public static final MediaSizeName ISO_A9 = new MediaSizeName(9);
-    
-    public static final MediaSizeName ISO_A10 = new MediaSizeName(10);  
+
+    public static final MediaSizeName ISO_A10 = new MediaSizeName(10);
 
     public static final MediaSizeName ISO_B0 = new MediaSizeName(11);
-    
+
     public static final MediaSizeName ISO_B1 = new MediaSizeName(12);
-    
+
     public static final MediaSizeName ISO_B2 = new MediaSizeName(13);
-    
+
     public static final MediaSizeName ISO_B3 = new MediaSizeName(14);
-   
+
     public static final MediaSizeName ISO_B4 = new MediaSizeName(15);
-   
+
     public static final MediaSizeName ISO_B5 = new MediaSizeName(16);
-    
+
     public static final MediaSizeName ISO_B6 = new MediaSizeName(17);
-    
+
     public static final MediaSizeName ISO_B7 = new MediaSizeName(18);
-    
+
     public static final MediaSizeName ISO_B8 = new MediaSizeName(19);
-    
+
     public static final MediaSizeName ISO_B9 = new MediaSizeName(20);
-   
-    public static final MediaSizeName ISO_B10 = new MediaSizeName(21);  
+
+    public static final MediaSizeName ISO_B10 = new MediaSizeName(21);
 
     public static final MediaSizeName JIS_B0 = new MediaSizeName(22);
-  
+
     public static final MediaSizeName JIS_B1 = new MediaSizeName(23);
-   
+
     public static final MediaSizeName JIS_B2 = new MediaSizeName(24);
-    
+
     public static final MediaSizeName JIS_B3 = new MediaSizeName(25);
-    
+
     public static final MediaSizeName JIS_B4 = new MediaSizeName(26);
-    
+
     public static final MediaSizeName JIS_B5 = new MediaSizeName(27);
-    
+
     public static final MediaSizeName JIS_B6 = new MediaSizeName(28);
-    
+
     public static final MediaSizeName JIS_B7 = new MediaSizeName(29);
-    
+
     public static final MediaSizeName JIS_B8 = new MediaSizeName(30);
-    
+
     public static final MediaSizeName JIS_B9 = new MediaSizeName(31);
-    
+
     public static final MediaSizeName JIS_B10 = new MediaSizeName(32);
 
     public static final MediaSizeName ISO_C0 = new MediaSizeName(33);
-    
+
     public static final MediaSizeName ISO_C1 = new MediaSizeName(34);
-    
+
     public static final MediaSizeName ISO_C2 = new MediaSizeName(35);
-    
+
     public static final MediaSizeName ISO_C3 = new MediaSizeName(36);
-    
+
     public static final MediaSizeName ISO_C4 = new MediaSizeName(37);
-    
+
     public static final MediaSizeName ISO_C5 = new MediaSizeName(38);
-    
+
     public static final MediaSizeName ISO_C6 = new MediaSizeName(39);
-    
+
     public static final MediaSizeName NA_LETTER = new MediaSizeName(40);
 
     public static final MediaSizeName NA_LEGAL = new MediaSizeName(41);
@@ -127,11 +122,9 @@
 
     public static final MediaSizeName QUARTO = new MediaSizeName(47);
 
-    public static final MediaSizeName 
-                            JAPANESE_POSTCARD = new MediaSizeName(48);
-   
-    public static final MediaSizeName 
-                            JAPANESE_DOUBLE_POSTCARD = new MediaSizeName(49);
+    public static final MediaSizeName JAPANESE_POSTCARD = new MediaSizeName(48);
+
+    public static final MediaSizeName JAPANESE_DOUBLE_POSTCARD = new MediaSizeName(49);
 
     public static final MediaSizeName A = new MediaSizeName(50);
 
@@ -143,218 +136,79 @@
 
     public static final MediaSizeName E = new MediaSizeName(54);
 
-    public static final MediaSizeName 
-                            ISO_DESIGNATED_LONG = new MediaSizeName(55);
+    public static final MediaSizeName ISO_DESIGNATED_LONG = new MediaSizeName(55);
 
-    public static final MediaSizeName ITALY_ENVELOPE = new MediaSizeName(56); 
+    public static final MediaSizeName ITALY_ENVELOPE = new MediaSizeName(56);
 
     public static final MediaSizeName MONARCH_ENVELOPE = new MediaSizeName(57);
-    
-    public static final MediaSizeName 
-                            PERSONAL_ENVELOPE = new MediaSizeName(58);
-    
-    public static final MediaSizeName 
-                            NA_NUMBER_9_ENVELOPE = new MediaSizeName(59);
-    
-    public static final MediaSizeName 
-                            NA_NUMBER_10_ENVELOPE = new MediaSizeName(60);
-    
-    public static final MediaSizeName 
-                            NA_NUMBER_11_ENVELOPE = new MediaSizeName(61);
-    
-    public static final MediaSizeName 
-                            NA_NUMBER_12_ENVELOPE = new MediaSizeName(62);
-   
-    public static final MediaSizeName 
-                            NA_NUMBER_14_ENVELOPE = new MediaSizeName(63);
-   
+
+    public static final MediaSizeName PERSONAL_ENVELOPE = new MediaSizeName(58);
+
+    public static final MediaSizeName NA_NUMBER_9_ENVELOPE = new MediaSizeName(59);
+
+    public static final MediaSizeName NA_NUMBER_10_ENVELOPE = new MediaSizeName(60);
+
+    public static final MediaSizeName NA_NUMBER_11_ENVELOPE = new MediaSizeName(61);
+
+    public static final MediaSizeName NA_NUMBER_12_ENVELOPE = new MediaSizeName(62);
+
+    public static final MediaSizeName NA_NUMBER_14_ENVELOPE = new MediaSizeName(63);
+
     public static final MediaSizeName NA_6X9_ENVELOPE = new MediaSizeName(64);
-   
+
     public static final MediaSizeName NA_7X9_ENVELOPE = new MediaSizeName(65);
-   
+
     public static final MediaSizeName NA_9X11_ENVELOPE = new MediaSizeName(66);
-    
-    public static final MediaSizeName 
-                            NA_9X12_ENVELOPE = new MediaSizeName(67);
+
+    public static final MediaSizeName NA_9X12_ENVELOPE = new MediaSizeName(67);
 
     public static final MediaSizeName NA_10X13_ENVELOPE = new MediaSizeName(68);
-    
+
     public static final MediaSizeName NA_10X14_ENVELOPE = new MediaSizeName(69);
-    
+
     public static final MediaSizeName NA_10X15_ENVELOPE = new MediaSizeName(70);
 
     public static final MediaSizeName NA_5X7 = new MediaSizeName(71);
 
     public static final MediaSizeName NA_8X10 = new MediaSizeName(72);
-        
-
-    private static final String[] stringTable =  { 
 
-        "iso-a0",
-        "iso-a1",
-        "iso-a2",
-        "iso-a3",
-        "iso-a4",
-        "iso-a5",
-        "iso-a6",
-        "iso-a7",
-        "iso-a8",
-        "iso-a9",
-        "iso-a10",
-        "iso-b0",
-        "iso-b1",
-        "iso-b2",
-        "iso-b3",
-        "iso-b4",
-        "iso-b5",
-        "iso-b6",
-        "iso-b7",
-        "iso-b8",
-        "iso-b9",
-        "iso-b10",
-        "jis-b0",
-        "jis-b1",
-        "jis-b2",
-        "jis-b3",
-        "jis-b4",
-        "jis-b5",
-        "jis-b6",
-        "jis-b7",
-        "jis-b8",
-        "jis-b9",
-        "jis-b10",
-        "iso-c0",
-        "iso-c1",
-        "iso-c2",
-        "iso-c3",
-        "iso-c4",
-        "iso-c5",
-        "iso-c6",
-        "na-letter",
-        "na-legal",
-        "executive",
-        "ledger",
-        "tabloid",
-        "invoice",
-        "folio",
-        "quarto",
-        "japanese-postcard",
-        "japanese-double-postcard",
-        "a",
-        "b",
-        "c",
-        "d",
-        "e",
-        "iso-designated-long",
-        "italy-envelope",
-        "monarch-envelope",
-        "personal-envelope",
-        "na-number-9-envelope",
-        "na-number-10-envelope",
-        "na-number-11-envelope",
-        "na-number-12-envelope",
-        "na-number-14-envelope",
-        "na-6x9-envelope",
-        "na-7x9-envelope",
-        "na-9x11-envelope",
-        "na-9x12-envelope",
-        "na-10x13-envelope",
-        "na-10x14-envelope",
-        "na-10x15-envelope",
-        "na-5x7",
-        "na-8x10"
-    };
-
-    private static final MediaSizeName[] enumValueTable = {
-
-        ISO_A0,
-        ISO_A1,
-        ISO_A2,
-        ISO_A3,
-        ISO_A4,
-        ISO_A5,
-        ISO_A6,
-        ISO_A7,
-        ISO_A8,
-        ISO_A9,
-        ISO_A10,
-        ISO_B0,
-        ISO_B1,
-        ISO_B2,
-        ISO_B3,
-        ISO_B4,
-        ISO_B5,
-        ISO_B6,
-        ISO_B7,
-        ISO_B8,
-        ISO_B9,
-        ISO_B10,
-        JIS_B0,
-        JIS_B1,
-        JIS_B2,
-        JIS_B3,
-        JIS_B4,
-        JIS_B5,
-        JIS_B6,
-        JIS_B7,
-        JIS_B8,
-        JIS_B9,
-        JIS_B10,
-        ISO_C0,
-        ISO_C1,
-        ISO_C2,
-        ISO_C3,
-        ISO_C4,
-        ISO_C5,
-        ISO_C6,
-        NA_LETTER,
-        NA_LEGAL,
-        EXECUTIVE,
-        LEDGER,
-        TABLOID,
-        INVOICE,
-        FOLIO,
-        QUARTO,
-        JAPANESE_POSTCARD,
-        JAPANESE_DOUBLE_POSTCARD,
-        A,
-        B,
-        C,
-        D,
-        E,
-        ISO_DESIGNATED_LONG,
-        ITALY_ENVELOPE,
-        MONARCH_ENVELOPE,
-        PERSONAL_ENVELOPE,
-        NA_NUMBER_9_ENVELOPE,
-        NA_NUMBER_10_ENVELOPE,
-        NA_NUMBER_11_ENVELOPE,
-        NA_NUMBER_12_ENVELOPE,
-        NA_NUMBER_14_ENVELOPE,
-        NA_6X9_ENVELOPE,
-        NA_7X9_ENVELOPE,
-        NA_9X11_ENVELOPE,
-        NA_9X12_ENVELOPE,
-        NA_10X13_ENVELOPE,
-        NA_10X14_ENVELOPE,
-        NA_10X15_ENVELOPE,
-        NA_5X7,
-        NA_8X10
+    private static final String[] stringTable = { "iso-a0", "iso-a1", "iso-a2", "iso-a3",
+            "iso-a4", "iso-a5", "iso-a6", "iso-a7", "iso-a8", "iso-a9", "iso-a10", "iso-b0",
+            "iso-b1", "iso-b2", "iso-b3", "iso-b4", "iso-b5", "iso-b6", "iso-b7", "iso-b8",
+            "iso-b9", "iso-b10", "jis-b0", "jis-b1", "jis-b2", "jis-b3", "jis-b4", "jis-b5",
+            "jis-b6", "jis-b7", "jis-b8", "jis-b9", "jis-b10", "iso-c0", "iso-c1", "iso-c2",
+            "iso-c3", "iso-c4", "iso-c5", "iso-c6", "na-letter", "na-legal", "executive",
+            "ledger", "tabloid", "invoice", "folio", "quarto", "japanese-postcard",
+            "japanese-double-postcard", "a", "b", "c", "d", "e", "iso-designated-long",
+            "italy-envelope", "monarch-envelope", "personal-envelope", "na-number-9-envelope",
+            "na-number-10-envelope", "na-number-11-envelope", "na-number-12-envelope",
+            "na-number-14-envelope", "na-6x9-envelope", "na-7x9-envelope", "na-9x11-envelope",
+            "na-9x12-envelope", "na-10x13-envelope", "na-10x14-envelope", "na-10x15-envelope",
+            "na-5x7", "na-8x10" };
+
+    private static final MediaSizeName[] enumValueTable = { ISO_A0, ISO_A1, ISO_A2, ISO_A3,
+            ISO_A4, ISO_A5, ISO_A6, ISO_A7, ISO_A8, ISO_A9, ISO_A10, ISO_B0, ISO_B1, ISO_B2,
+            ISO_B3, ISO_B4, ISO_B5, ISO_B6, ISO_B7, ISO_B8, ISO_B9, ISO_B10, JIS_B0, JIS_B1,
+            JIS_B2, JIS_B3, JIS_B4, JIS_B5, JIS_B6, JIS_B7, JIS_B8, JIS_B9, JIS_B10, ISO_C0,
+            ISO_C1, ISO_C2, ISO_C3, ISO_C4, ISO_C5, ISO_C6, NA_LETTER, NA_LEGAL, EXECUTIVE,
+            LEDGER, TABLOID, INVOICE, FOLIO, QUARTO, JAPANESE_POSTCARD,
+            JAPANESE_DOUBLE_POSTCARD, A, B, C, D, E, ISO_DESIGNATED_LONG, ITALY_ENVELOPE,
+            MONARCH_ENVELOPE, PERSONAL_ENVELOPE, NA_NUMBER_9_ENVELOPE, NA_NUMBER_10_ENVELOPE,
+            NA_NUMBER_11_ENVELOPE, NA_NUMBER_12_ENVELOPE, NA_NUMBER_14_ENVELOPE,
+            NA_6X9_ENVELOPE, NA_7X9_ENVELOPE, NA_9X11_ENVELOPE, NA_9X12_ENVELOPE,
+            NA_10X13_ENVELOPE, NA_10X14_ENVELOPE, NA_10X15_ENVELOPE, NA_5X7, NA_8X10 };
 
-    };
-
-    
     protected MediaSizeName(int value) {
         super(value);
     }
-    
 
+    @Override
     protected EnumSyntax[] getEnumValueTable() {
-        return (EnumSyntax[]) enumValueTable.clone();
+        return enumValueTable.clone();
     }
-    
+
+    @Override
     protected String[] getStringTable() {
-        return (String[]) stringTable.clone();
+        return stringTable.clone();
     }
-
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MediaTray.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MediaTray.java?view=diff&rev=469773&r1=469772&r2=469773
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MediaTray.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MediaTray.java Tue Oct 31 19:58:05 2006
@@ -14,10 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Elena V. Sayapina 
- * @version $Revision: 1.4 $ 
- */ 
 
 package javax.print.attribute.standard;
 
@@ -28,9 +24,8 @@
  * Table values are obtained from RFC2911: Internet Printing Protocol/1.1: 
  * Model and Semantics, Appendix C, http://ietf.org/rfc/rfc2911.txt?number=2911
  */
-
 public class MediaTray extends Media implements Attribute {
-
+    private static final long serialVersionUID = -982503611095214703L;
 
     public static final MediaTray TOP = new MediaTray(0);
 
@@ -47,38 +42,24 @@
     public static final MediaTray MAIN = new MediaTray(6);
 
     public static final MediaTray SIDE = new MediaTray(7);
-    
 
-    private static final MediaTray[] enumValueTable = { TOP,
-                                                        MIDDLE,
-                                                        BOTTOM,
-                                                        ENVELOPE,
-                                                        MANUAL,
-                                                        LARGE_CAPACITY,
-                                                        MAIN,
-                                                        SIDE };
-    private static final String[] stringTable ={ "top",
-                                                 "middle",
-                                                 "bottom",
-                                                 "envelope",
-                                                 "manual",
-                                                 "large-capacity",
-                                                 "main",
-                                                 "side" };
-    
-    
+    private static final MediaTray[] enumValueTable = { TOP, MIDDLE, BOTTOM, ENVELOPE, MANUAL,
+            LARGE_CAPACITY, MAIN, SIDE };
+
+    private static final String[] stringTable = { "top", "middle", "bottom", "envelope",
+            "manual", "large-capacity", "main", "side" };
+
     protected MediaTray(int value) {
         super(value);
     }
-    
 
+    @Override
     protected EnumSyntax[] getEnumValueTable() {
-        return (EnumSyntax[]) enumValueTable.clone();
+        return enumValueTable.clone();
     }
-    
+
+    @Override
     protected String[] getStringTable() {
-        return (String[]) stringTable.clone();
+        return stringTable.clone();
     }
-
-    
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MultipleDocumentHandling.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MultipleDocumentHandling.java?view=diff&rev=469773&r1=469772&r2=469773
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MultipleDocumentHandling.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/MultipleDocumentHandling.java Tue Oct 31 19:58:05 2006
@@ -14,13 +14,10 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Elena V. Sayapina 
- * @version $Revision: 1.5 $ 
- */ 
 
 package javax.print.attribute.standard;
 
+import javax.print.attribute.Attribute;
 import javax.print.attribute.EnumSyntax;
 import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
@@ -29,63 +26,49 @@
  * Table values are obtained from RFC2911: Internet Printing Protocol/1.1: 
  * Model and Semantics, section 4.2.4, http://ietf.org/rfc/rfc2911.txt?number=2911
  */
+public class MultipleDocumentHandling extends EnumSyntax implements PrintJobAttribute,
+        PrintRequestAttribute {
+    private static final long serialVersionUID = 8098326460746413466L;
 
-public class MultipleDocumentHandling extends EnumSyntax 
-    implements PrintJobAttribute, PrintRequestAttribute {
+    public static final MultipleDocumentHandling SINGLE_DOCUMENT = new MultipleDocumentHandling(
+            0);
 
+    public static final MultipleDocumentHandling SEPARATE_DOCUMENTS_UNCOLLATED_COPIES = new MultipleDocumentHandling(
+            1);
 
-    public static final MultipleDocumentHandling
-        SINGLE_DOCUMENT = new MultipleDocumentHandling (0);
+    public static final MultipleDocumentHandling SEPARATE_DOCUMENTS_COLLATED_COPIES = new MultipleDocumentHandling(
+            2);
+
+    public static final MultipleDocumentHandling SINGLE_DOCUMENT_NEW_SHEET = new MultipleDocumentHandling(
+            3);
+
+    private static final MultipleDocumentHandling[] enumValueTable = { SINGLE_DOCUMENT,
+            SEPARATE_DOCUMENTS_UNCOLLATED_COPIES, SEPARATE_DOCUMENTS_COLLATED_COPIES,
+            SINGLE_DOCUMENT_NEW_SHEET };
+
+    private static final String[] stringTable = { "single-document",
+            "separate-documents-uncollated-copies", "separate-documents-collated-copies",
+            "single-document-new-sheet" };
 
-    public static final MultipleDocumentHandling 
-        SEPARATE_DOCUMENTS_UNCOLLATED_COPIES = new MultipleDocumentHandling (1);
-
-    public static final MultipleDocumentHandling 
-        SEPARATE_DOCUMENTS_COLLATED_COPIES = new MultipleDocumentHandling (2);
-
-    public static final MultipleDocumentHandling
-        SINGLE_DOCUMENT_NEW_SHEET = new MultipleDocumentHandling (3);
-
-    
-    private static final MultipleDocumentHandling[] enumValueTable = { 
-
-        SINGLE_DOCUMENT,
-        SEPARATE_DOCUMENTS_UNCOLLATED_COPIES,
-        SEPARATE_DOCUMENTS_COLLATED_COPIES,
-        SINGLE_DOCUMENT_NEW_SHEET
-    };
-    
-    private static final String[] stringTable = {
-
-        "single-document",
-        "separate-documents-uncollated-copies",
-        "separate-documents-collated-copies",
-        "single-document-new-sheet"
-    };
-    
-    
     protected MultipleDocumentHandling(int value) {
         super(value);
     }
-    
-    
-    public final Class getCategory() {
-    /* 1.5 support requires the following changes 
-       Class<? extends Attribute> getCategory() { */
+
+    public final Class<? extends Attribute> getCategory() {
         return MultipleDocumentHandling.class;
     }
-    
+
+    @Override
     protected EnumSyntax[] getEnumValueTable() {
-        return (EnumSyntax[]) enumValueTable.clone();
+        return enumValueTable.clone();
     }
-    
+
     public final String getName() {
         return "multiple-document-handling";
     }
-    
+
+    @Override
     protected String[] getStringTable() {
-        return (String[]) stringTable.clone();
+        return stringTable.clone();
     }
-    
-
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/NumberOfDocuments.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/NumberOfDocuments.java?view=diff&rev=469773&r1=469772&r2=469773
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/NumberOfDocuments.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/NumberOfDocuments.java Tue Oct 31 19:58:05 2006
@@ -14,41 +14,33 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Elena V. Sayapina 
- * @version $Revision: 1.5 $ 
- */ 
 
 package javax.print.attribute.standard;
 
+import javax.print.attribute.Attribute;
 import javax.print.attribute.IntegerSyntax;
 import javax.print.attribute.PrintJobAttribute;
 
-public final class NumberOfDocuments extends IntegerSyntax 
-    implements PrintJobAttribute {
-
+public final class NumberOfDocuments extends IntegerSyntax implements PrintJobAttribute {
+    private static final long serialVersionUID = 7891881310684461097L;
 
     public NumberOfDocuments(int value) {
         super(value, 0, Integer.MAX_VALUE);
     }
 
-
+    @Override
     public boolean equals(Object object) {
-        if ( !(object instanceof NumberOfDocuments) ) {
+        if (!(object instanceof NumberOfDocuments)) {
             return false;
         }
         return super.equals(object);
     }
 
-    public final Class getCategory() {
-    /* 1.5 support requires the following changes
-       Class<? extends Attribute> getCategory() { */
+    public final Class<? extends Attribute> getCategory() {
         return NumberOfDocuments.class;
     }
 
     public final String getName() {
         return "number-of-documents";
     }
-
-
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/NumberOfInterveningJobs.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/NumberOfInterveningJobs.java?view=diff&rev=469773&r1=469772&r2=469773
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/NumberOfInterveningJobs.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/NumberOfInterveningJobs.java Tue Oct 31 19:58:05 2006
@@ -14,41 +14,33 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Elena V. Sayapina 
- * @version $Revision: 1.5 $ 
- */ 
 
 package javax.print.attribute.standard;
 
+import javax.print.attribute.Attribute;
 import javax.print.attribute.IntegerSyntax;
 import javax.print.attribute.PrintJobAttribute;
 
-public final class NumberOfInterveningJobs extends IntegerSyntax 
-    implements PrintJobAttribute {
-
+public final class NumberOfInterveningJobs extends IntegerSyntax implements PrintJobAttribute {
+    private static final long serialVersionUID = 2568141124844982746L;
 
     public NumberOfInterveningJobs(int value) {
         super(value, 0, Integer.MAX_VALUE);
     }
 
-
+    @Override
     public boolean equals(Object object) {
-        if ( !(object instanceof NumberOfInterveningJobs) ) {
+        if (!(object instanceof NumberOfInterveningJobs)) {
             return false;
         }
         return super.equals(object);
     }
 
-    public final Class getCategory() {
-    /* 1.5 support requires the following changes
-       Class<? extends Attribute> getCategory() { */
+    public final Class<? extends Attribute> getCategory() {
         return NumberOfInterveningJobs.class;
     }
 
     public final String getName() {
         return "number-of-intervening-jobs";
     }
-
-
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/NumberUp.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/NumberUp.java?view=diff&rev=469773&r1=469772&r2=469773
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/NumberUp.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/NumberUp.java Tue Oct 31 19:58:05 2006
@@ -14,43 +14,36 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Elena V. Sayapina 
- * @version $Revision: 1.5 $ 
- */ 
 
 package javax.print.attribute.standard;
 
+import javax.print.attribute.Attribute;
 import javax.print.attribute.DocAttribute;
 import javax.print.attribute.IntegerSyntax;
 import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
 
-public final class NumberUp extends IntegerSyntax 
-    implements DocAttribute, PrintJobAttribute, PrintRequestAttribute {
-
+public final class NumberUp extends IntegerSyntax implements DocAttribute, PrintJobAttribute,
+        PrintRequestAttribute {
+    private static final long serialVersionUID = -3040436486786527811L;
 
     public NumberUp(int value) {
         super(value, 1, Integer.MAX_VALUE);
     }
 
-
+    @Override
     public boolean equals(Object object) {
-        if ( !(object instanceof NumberUp) ) {
+        if (!(object instanceof NumberUp)) {
             return false;
         }
         return super.equals(object);
     }
 
-    public final Class getCategory() {
-    /* 1.5 support requires the following changes 
-       Class<? extends Attribute> getCategory() { */
+    public final Class<? extends Attribute> getCategory() {
         return NumberUp.class;
     }
 
     public final String getName() {
         return "number-up";
     }
-
-
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/NumberUpSupported.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/NumberUpSupported.java?view=diff&rev=469773&r1=469772&r2=469773
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/NumberUpSupported.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/javax/print/attribute/standard/NumberUpSupported.java Tue Oct 31 19:58:05 2006
@@ -14,36 +14,30 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Elena V. Sayapina 
- * @version $Revision: 1.5 $ 
- */ 
 
 package javax.print.attribute.standard;
 
+import javax.print.attribute.Attribute;
 import javax.print.attribute.SetOfIntegerSyntax;
 import javax.print.attribute.SupportedValuesAttribute;
 
-public final class NumberUpSupported extends SetOfIntegerSyntax 
-    implements SupportedValuesAttribute {
-
+public final class NumberUpSupported extends SetOfIntegerSyntax implements
+        SupportedValuesAttribute {
+    private static final long serialVersionUID = -1041573395759141805L;
 
     public NumberUpSupported(int value) {
         super(value);
         if (value < 1) {
-            throw new IllegalArgumentException("Value" + value +
-                                                    "is less than 1");
+            throw new IllegalArgumentException("Value" + value + "is less than 1");
         }
     }
 
     public NumberUpSupported(int lowerBound, int upperBound) {
         super(lowerBound, upperBound);
         if (lowerBound > upperBound) {
-            throw new IllegalArgumentException("Null range: lowerBound " +
-                                                            "> upperBound");
+            throw new IllegalArgumentException("Null range: lowerBound " + "> upperBound");
         } else if (lowerBound < 1) {
-            throw new IllegalArgumentException("Lower bound " + lowerBound +
-                                                            " is less than 1");
+            throw new IllegalArgumentException("Lower bound " + lowerBound + " is less than 1");
         }
     }
 
@@ -54,33 +48,28 @@
         }
         int[][] canonicalArray = getMembers();
         if (canonicalArray.length == 0) {
-                throw new IllegalArgumentException("Zero-length array");
+            throw new IllegalArgumentException("Zero-length array");
         }
         for (int i = 0; i < canonicalArray.length; i++) {
             if (canonicalArray[i][0] < 1) {
-                throw new IllegalArgumentException("Valid values are not " +
-                                                                "less than 1");
+                throw new IllegalArgumentException("Valid values are not " + "less than 1");
             }
         }
     }
 
-
+    @Override
     public boolean equals(Object object) {
-        if( !(object instanceof NumberUpSupported) ) {
+        if (!(object instanceof NumberUpSupported)) {
             return false;
         }
         return super.equals(object);
     }
 
-    public Class getCategory() {
-    /* 1.5 support requires the following changes
-       Class<? extends Attribute> getCategory() { */
+    public Class<? extends Attribute> getCategory() {
         return NumberUpSupported.class;
     }
 
     public String getName() {
         return "number-up-supported";
     }
-
-
 }



Mime
View raw message