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.SupportedValuesAttribute;
  30 
  31 /**
  32  * Class JobPrioritySupported is an integer valued printing attribute class
  33  * that specifies whether a Print Service instance supports the {@link
  34  * JobPriority JobPriority} attribute and the number of different job priority
  35  * levels supported.
  36  * <P>
  37  * The client can always specify any {@link JobPriority JobPriority} value
  38  * from 1 to 100 for a job. However, the Print Service instance may support
  39  * fewer than 100 different job priority levels. If this is the case, the
  40  * Print Service instance automatically maps the client-specified job priority
  41  * value to one of the supported job priority levels, dividing the 100 job
  42  * priority values equally among the available job priority levels.
  43  * <P>
  44  * <B>IPP Compatibility:</B> The integer value gives the IPP integer value.
  45  * The category name returned by <CODE>getName()</CODE> gives the IPP
  46  * attribute name.
  47  *
  48  * @author  Alan Kaminsky
  49  */
  50 public final class JobPrioritySupported extends IntegerSyntax
  51     implements SupportedValuesAttribute {
  52 
  53     private static final long serialVersionUID = 2564840378013555894L;
  54 
  55 
  56     /**
  57      * Construct a new job priority supported attribute with the given integer
  58      * value.
  59      *
  60      * @param  value  Number of different job priority levels supported.
  61      *
  62      * @exception  IllegalArgumentException
  63      *     (Unchecked exception) Thrown if <CODE>value</CODE> is less than 1
  64      *     or greater than 100.
  65      */
  66     public JobPrioritySupported(int value) {
  67         super (value, 1, 100);
  68     }
  69 
  70     /**
  71      * Returns whether this job priority supported attribute is equivalent to
  72      * the passed in object. To be equivalent, all of the following conditions
  73      * must be true:
  74      * <OL TYPE=1>
  75      * <LI>
  76      * <CODE>object</CODE> is not null.
  77      * <LI>
  78      * <CODE>object</CODE> is an instance of class JobPrioritySupported.
  79      * <LI>
  80      * This job priority supported attribute's value and
  81      * <CODE>object</CODE>'s value are equal.
  82      * </OL>
  83      *
  84      * @param  object  Object to compare to.
  85      *
  86      * @return  True if <CODE>object</CODE> is equivalent to this job
  87      *          priority supported attribute, false otherwise.
  88      */
  89     public boolean equals (Object object) {
  90 
  91         return (super.equals(object) &&
  92                object instanceof JobPrioritySupported);
  93     }
  94 
  95 
  96     /**
  97      * Get the printing attribute class which is to be used as the "category"
  98      * for this printing attribute value.
  99      * <P>
 100      * For class JobPrioritySupported, the
 101      * category is class JobPrioritySupported itself.
 102      *
 103      * @return  Printing attribute class (category), an instance of class
 104      *          {@link java.lang.Class java.lang.Class}.
 105      */
 106     public final Class<? extends Attribute> getCategory() {
 107         return JobPrioritySupported.class;
 108     }
 109 
 110     /**
 111      * Get the name of the category of which this attribute value is an
 112      * instance.
 113      * <P>
 114      * For class JobPrioritySupported, the
 115      * category name is <CODE>"job-priority-supported"</CODE>.
 116      *
 117      * @return  Attribute category name.
 118      */
 119     public final String getName() {
 120         return "job-priority-supported";
 121     }
 122 
 123 }