J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2000-2004 Sun Microsystems, Inc. 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. Sun designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 22 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 23 | * have any 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 | * <P> |
| 48 | * |
| 49 | * @author Alan Kaminsky |
| 50 | */ |
| 51 | public final class JobPrioritySupported extends IntegerSyntax |
| 52 | implements SupportedValuesAttribute { |
| 53 | |
| 54 | private static final long serialVersionUID = 2564840378013555894L; |
| 55 | |
| 56 | |
| 57 | /** |
| 58 | * Construct a new job priority supported attribute with the given integer |
| 59 | * value. |
| 60 | * |
| 61 | * @param value Number of different job priority levels supported. |
| 62 | * |
| 63 | * @exception IllegalArgumentException |
| 64 | * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 1 |
| 65 | * or greater than 100. |
| 66 | */ |
| 67 | public JobPrioritySupported(int value) { |
| 68 | super (value, 1, 100); |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * Returns whether this job priority supported attribute is equivalent to |
| 73 | * the passed in object. To be equivalent, all of the following conditions |
| 74 | * must be true: |
| 75 | * <OL TYPE=1> |
| 76 | * <LI> |
| 77 | * <CODE>object</CODE> is not null. |
| 78 | * <LI> |
| 79 | * <CODE>object</CODE> is an instance of class JobPrioritySupported. |
| 80 | * <LI> |
| 81 | * This job priority supported attribute's value and |
| 82 | * <CODE>object</CODE>'s value are equal. |
| 83 | * </OL> |
| 84 | * |
| 85 | * @param object Object to compare to. |
| 86 | * |
| 87 | * @return True if <CODE>object</CODE> is equivalent to this job |
| 88 | * priority supported attribute, false otherwise. |
| 89 | */ |
| 90 | public boolean equals (Object object) { |
| 91 | |
| 92 | return (super.equals(object) && |
| 93 | object instanceof JobPrioritySupported); |
| 94 | } |
| 95 | |
| 96 | |
| 97 | /** |
| 98 | * Get the printing attribute class which is to be used as the "category" |
| 99 | * for this printing attribute value. |
| 100 | * <P> |
| 101 | * For class JobPrioritySupported, the |
| 102 | * category is class JobPrioritySupported itself. |
| 103 | * |
| 104 | * @return Printing attribute class (category), an instance of class |
| 105 | * {@link java.lang.Class java.lang.Class}. |
| 106 | */ |
| 107 | public final Class<? extends Attribute> getCategory() { |
| 108 | return JobPrioritySupported.class; |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * Get the name of the category of which this attribute value is an |
| 113 | * instance. |
| 114 | * <P> |
| 115 | * For class JobPrioritySupported, the |
| 116 | * category name is <CODE>"job-priority-supported"</CODE>. |
| 117 | * |
| 118 | * @return Attribute category name. |
| 119 | */ |
| 120 | public final String getName() { |
| 121 | return "job-priority-supported"; |
| 122 | } |
| 123 | |
| 124 | } |