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
  23  * questions.
  24  */
  25 package javax.print.attribute.standard;
  26 
  27 import javax.print.attribute.Attribute;
  28 import javax.print.attribute.IntegerSyntax;
  29 import javax.print.attribute.PrintServiceAttribute;
  30 
  31 /**
  32  * Class PagesPerMinuteColor is an integer valued printing attribute that
  33  * indicates the nominal number of pages per minute to the nearest whole number
  34  * which may be generated by this printer when printing color (e.g., simplex,
  35  * color). For purposes of this attribute, "color" means the same as for the
  36  * {@link ColorSupported ColorSupported} attribute, namely, the device is
  37  * capable of any type of color printing at all, including highlight color as
  38  * well as full process color. This attribute is informative, not a service
  39  * guarantee. Generally, it is the value used in the marketing literature to
  40  * describe the color capabilities of this device. A value of 0 indicates a
  41  * device that takes more than two minutes to process a page. If a color device
  42  * has several color modes, it may use the pages-per- minute value for this
  43  * attribute that corresponds to the mode that produces the highest number.
  44  * <P>
  45  * A black and white only printer must not include the PagesPerMinuteColor
  46  * attribute in its attribute set or service registration. If this attribute is
  47  * present, then the {@link ColorSupported ColorSupported} printer description
  48  * attribute must also be present and have a value of SUPPORTED.
  49  * <P>
  50  * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
  51  * category name returned by <CODE>getName()</CODE> gives the IPP attribute
  52  * name.
  53  *
  54  * @author  Alan Kaminsky
  55  */
  56 public final class PagesPerMinuteColor extends IntegerSyntax
  57         implements PrintServiceAttribute {
  58 
  59     static final long serialVersionUID = 1684993151687470944L;
  60 
  61     /**
  62      * Construct a new pages per minute color attribute with the given integer
  63      * value.
  64      *
  65      * @param  value  Integer value.
  66      *
  67      * @exception  IllegalArgumentException
  68      *    (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0.
  69      */
  70     public PagesPerMinuteColor(int value) {
  71         super(value, 0, Integer.MAX_VALUE);
  72     }
  73 
  74     /**
  75      * Returns whether this pages per minute color attribute is equivalent to
  76      * the passed in object. To be equivalent, all of the following conditions
  77      * must be true:
  78      * <OL TYPE=1>
  79      * <LI>
  80      * <CODE>object</CODE> is not null.
  81      * <LI>
  82      * <CODE>object</CODE> is an instance of class PagesPerMinuteColor.
  83      * <LI>
  84      * This pages per minute attribute's value and <CODE>object</CODE>'s
  85      * value are equal.
  86      * </OL>
  87      *
  88      * @param  object  Object to compare to.
  89      *
  90      * @return  True if <CODE>object</CODE> is equivalent to this pages per
  91      *          minute color attribute, false otherwise.
  92      */
  93     public boolean equals(Object object) {
  94         return (super.equals(object) &&
  95                 object instanceof PagesPerMinuteColor);
  96     }
  97 
  98     /**
  99      * Get the printing attribute class which is to be used as the "category"
 100      * for this printing attribute value.
 101      * <P>
 102      * For class PagesPerMinuteColor, the
 103      * category is class PagesPerMinuteColor itself.
 104      *
 105      * @return  Printing attribute class (category), an instance of class
 106      *          {@link java.lang.Class java.lang.Class}.
 107      */
 108     public final Class<? extends Attribute> getCategory() {
 109         return PagesPerMinuteColor.class;
 110     }
 111 
 112     /**
 113      * Get the name of the category of which this attribute value is an
 114      * instance.
 115      * <P>
 116      * For class PagesPerMinuteColor, the
 117      * category name is <CODE>"pages-per-minute-color"</CODE>.
 118      *
 119      * @return  Attribute category name.
 120      */
 121     public final String getName() {
 122         return "pages-per-minute-color";
 123     }
 124 
 125 }