001 /*
002 * Copyright 2000-2004 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025 package javax.print.attribute.standard;
026
027 import javax.print.attribute.Attribute;
028 import javax.print.attribute.IntegerSyntax;
029 import javax.print.attribute.PrintRequestAttribute;
030 import javax.print.attribute.PrintJobAttribute;
031
032 /**
033 * Class JobPriority is an integer valued printing attribute class that
034 * specifies a print job's priority.
035 * <P>
036 * If a JobPriority attribute is specified for a Print Job, it specifies a
037 * priority for scheduling the job. A higher value specifies a higher priority.
038 * The value 1 indicates the lowest possible priority. The value 100 indicates
039 * the highest possible priority. Among those jobs that are ready to print, a
040 * printer must print all jobs with a priority value of <I>n</I> before printing
041 * those with a priority value of <I>n</I>-1 for all <I>n.</I>
042 * <P>
043 * If the client does not specify a JobPriority attribute for a Print Job and
044 * the printer does support the JobPriority attribute, the printer must use an
045 * implementation-defined default JobPriority value.
046 * <P>
047 * The client can always specify any job priority value from 1 to 100 for a job.
048 * However, a Print Service instance may support fewer than 100 different
049 * job priority levels. If this is the case, the Print Service instance
050 * automatically maps the client-specified job priority value to one of the
051 * supported job priority levels, dividing the 100 job priority values equally
052 * among the available job priority levels.
053 * <P>
054 * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
055 * category name returned by <CODE>getName()</CODE> gives the IPP attribute
056 * name.
057 * <P>
058 *
059 * @author Alan Kaminsky
060 */
061 public final class JobPriority extends IntegerSyntax implements
062 PrintRequestAttribute, PrintJobAttribute {
063
064 private static final long serialVersionUID = -4599900369040602769L;
065
066 /**
067 * Construct a new job priority attribute with the given integer value.
068 *
069 * @param value Integer value.
070 *
071 * @exception IllegalArgumentException
072 * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 1
073 * or greater than 100.
074 */
075 public JobPriority(int value) {
076 super (value, 1, 100);
077 }
078
079 /**
080 * Returns whether this job priority attribute is equivalent to the passed
081 * in object. To be equivalent, all of the following conditions must be
082 * true:
083 * <OL TYPE=1>
084 * <LI>
085 * <CODE>object</CODE> is not null.
086 * <LI>
087 * <CODE>object</CODE> is an instance of class JobPriority.
088 * <LI>
089 * This job priority attribute's value and <CODE>object</CODE>'s value
090 * are equal.
091 * </OL>
092 *
093 * @param object Object to compare to.
094 *
095 * @return True if <CODE>object</CODE> is equivalent to this job
096 * priority attribute, false otherwise.
097 */
098 public boolean equals(Object object) {
099 return (super .equals(object) && object instanceof JobPriority);
100 }
101
102 /**
103 * Get the printing attribute class which is to be used as the "category"
104 * for this printing attribute value.
105 * <P>
106 * For class JobPriority, the category is class JobPriority itself.
107 *
108 * @return Printing attribute class (category), an instance of class
109 * {@link java.lang.Class java.lang.Class}.
110 */
111 public final Class<? extends Attribute> getCategory() {
112 return JobPriority.class;
113 }
114
115 /**
116 * Get the name of the category of which this attribute value is an
117 * instance.
118 * <P>
119 * For class JobPriority, the category name is <CODE>"job-priority"</CODE>.
120 *
121 * @return Attribute category name.
122 */
123 public final String getName() {
124 return "job-priority";
125 }
126
127 }
|