1 /*
   2  * Copyright (c) 2000, 2004, 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  * <P>
  54  *
  55  * @author  Alan Kaminsky
  56  */
  57 public final class PagesPerMinuteColor extends IntegerSyntax
  58         implements PrintServiceAttribute {
  59 
  60     static final long serialVersionUID = 1684993151687470944L;
  61 
  62     /**
  63      * Construct a new pages per minute color attribute with the given integer
  64      * value.
  65      *
  66      * @param  value  Integer value.
  67      *
  68      * @exception  IllegalArgumentException
  69      *    (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0.
  70      */
  71     public PagesPerMinuteColor(int value) {
  72         super(value, 0, Integer.MAX_VALUE);
  73     }
  74 
  75     /**
  76      * Returns whether this pages per minute color attribute is equivalent to
  77      * the passed in object. To be equivalent, all of the following conditions
  78      * must be true:
  79      * <OL TYPE=1>
  80      * <LI>
  81      * <CODE>object</CODE> is not null.
  82      * <LI>
  83      * <CODE>object</CODE> is an instance of class PagesPerMinuteColor.
  84      * <LI>
  85      * This pages per minute attribute's value and <CODE>object</CODE>'s
  86      * value are equal.
  87      * </OL>
  88      *
  89      * @param  object  Object to compare to.
  90      *
  91      * @return  True if <CODE>object</CODE> is equivalent to this pages per
  92      *          minute color attribute, false otherwise.
  93      */
  94     public boolean equals(Object object) {
  95         return (super.equals(object) &&
  96                 object instanceof PagesPerMinuteColor);
  97     }
  98 
  99     /**
 100      * Get the printing attribute class which is to be used as the "category"
 101      * for this printing attribute value.
 102      * <P>
 103      * For class PagesPerMinuteColor, the
 104      * category is class PagesPerMinuteColor itself.
 105      *
 106      * @return  Printing attribute class (category), an instance of class
 107      *          {@link java.lang.Class java.lang.Class}.
 108      */
 109     public final Class<? extends Attribute> getCategory() {
 110         return PagesPerMinuteColor.class;
 111     }
 112 
 113     /**
 114      * Get the name of the category of which this attribute value is an
 115      * instance.
 116      * <P>
 117      * For class PagesPerMinuteColor, the
 118      * category name is <CODE>"pages-per-minute-color"</CODE>.
 119      *
 120      * @return  Attribute category name.
 121      */
 122     public final String getName() {
 123         return "pages-per-minute-color";
 124     }
 125 
 126 }