src/share/classes/javax/print/attribute/Size2DSyntax.java

Print this page


   1 /*
   2  * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  60  * stored as 215900 µm. For example, a lookup service can
  61  * match resolution attributes based on equality of their serialized
  62  * representations regardless of the units in which they were created. Using
  63  * integers for internal storage allows precise equality comparisons to be done,
  64  * which would not be guaranteed if an internal floating point representation
  65  * were used. Note that if you're looking for U.S. letter sized media in metric
  66  * units, you have to search for a media size of 215.9 x 279.4 mm; rounding off
  67  * to an integral 216 x 279 mm will not match.
  68  * <P>
  69  * The exported constant {@link #INCH INCH} is actually the
  70  * conversion factor by which to multiply a value in inches to get the value in
  71  * µm. Likewise, the exported constant {@link #MM MM} is the
  72  * conversion factor by which to multiply a value in mm to get the value in
  73  * µm. A client can specify a resolution value in units other than inches
  74  * or mm by supplying its own conversion factor. However, since the internal
  75  * units of µm was chosen with supporting only the external units of inch
  76  * and mm in mind, there is no guarantee that the conversion factor for the
  77  * client's units will be an exact integer. If the conversion factor isn't an
  78  * exact integer, resolution values in the client's units won't be stored
  79  * precisely.
  80  * <P>
  81  *
  82  * @author  Alan Kaminsky
  83  */
  84 public abstract class Size2DSyntax implements Serializable, Cloneable {
  85 
  86     private static final long serialVersionUID = 5584439964938660530L;
  87 
  88     /**
  89      * X dimension in units of micrometers (µm).
  90      * @serial
  91      */
  92     private int x;
  93 
  94     /**
  95      * Y dimension in units of micrometers (µm).
  96      * @serial
  97      */
  98     private int y;
  99 
 100     /**


   1 /*
   2  * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  60  * stored as 215900 µm. For example, a lookup service can
  61  * match resolution attributes based on equality of their serialized
  62  * representations regardless of the units in which they were created. Using
  63  * integers for internal storage allows precise equality comparisons to be done,
  64  * which would not be guaranteed if an internal floating point representation
  65  * were used. Note that if you're looking for U.S. letter sized media in metric
  66  * units, you have to search for a media size of 215.9 x 279.4 mm; rounding off
  67  * to an integral 216 x 279 mm will not match.
  68  * <P>
  69  * The exported constant {@link #INCH INCH} is actually the
  70  * conversion factor by which to multiply a value in inches to get the value in
  71  * µm. Likewise, the exported constant {@link #MM MM} is the
  72  * conversion factor by which to multiply a value in mm to get the value in
  73  * µm. A client can specify a resolution value in units other than inches
  74  * or mm by supplying its own conversion factor. However, since the internal
  75  * units of µm was chosen with supporting only the external units of inch
  76  * and mm in mind, there is no guarantee that the conversion factor for the
  77  * client's units will be an exact integer. If the conversion factor isn't an
  78  * exact integer, resolution values in the client's units won't be stored
  79  * precisely.

  80  *
  81  * @author  Alan Kaminsky
  82  */
  83 public abstract class Size2DSyntax implements Serializable, Cloneable {
  84 
  85     private static final long serialVersionUID = 5584439964938660530L;
  86 
  87     /**
  88      * X dimension in units of micrometers (µm).
  89      * @serial
  90      */
  91     private int x;
  92 
  93     /**
  94      * Y dimension in units of micrometers (µm).
  95      * @serial
  96      */
  97     private int y;
  98 
  99     /**