blob: b7b9e91ccb6bdf5f726b6d40740a2fc49c6ec341 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
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 */
25package javax.print.attribute.standard;
26
27import javax.print.attribute.Attribute;
28import javax.print.attribute.SetOfIntegerSyntax;
29import javax.print.attribute.SupportedValuesAttribute;
30
31/**
32 * Class JobImpressionsSupported is a printing attribute class, a set of
33 * integers, that gives the supported values for a {@link JobImpressions
34 * JobImpressions} attribute. It is restricted to a single contiguous range of
35 * integers; multiple non-overlapping ranges are not allowed. This gives the
36 * lower and upper bounds of the total sizes of print jobs in number of
37 * impressions that the printer will accept.
38 * <P>
39 * <B>IPP Compatibility:</B> The JobImpressionsSupported attribute's canonical
40 * array form gives the lower and upper bound for the range of values to be
41 * included in an IPP "job-impressions-supported" attribute. See class {@link
42 * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an
43 * explanation of canonical array form. The category name returned by
44 * <CODE>getName()</CODE> gives the IPP attribute name.
45 * <P>
46 *
47 * @author Alan Kaminsky
48 */
49public final class JobImpressionsSupported extends SetOfIntegerSyntax
50 implements SupportedValuesAttribute {
51
52 private static final long serialVersionUID = -4887354803843173692L;
53
54
55 /**
56 * Construct a new job impressions supported attribute containing a single
57 * range of integers. That is, only those values of JobImpressions in the
58 * one range are supported.
59 *
60 * @param lowerBound Lower bound of the range.
61 * @param upperBound Upper bound of the range.
62 *
63 * @exception IllegalArgumentException
64 * (Unchecked exception) Thrown if a null range is specified or if a
65 * non-null range is specified with <CODE>lowerBound</CODE> less than
66 * 0.
67 */
68 public JobImpressionsSupported(int lowerBound, int upperBound) {
69 super (lowerBound, upperBound);
70 if (lowerBound > upperBound) {
71 throw new IllegalArgumentException("Null range specified");
72 } else if (lowerBound < 0) {
73 throw new IllegalArgumentException(
74 "Job K octets value < 0 specified");
75 }
76 }
77
78
79 /**
80 * Returns whether this job impressions supported attribute is equivalent
81 * to the passed in object. To be equivalent, all of the following
82 * conditions must be true:
83 * <OL TYPE=1>
84 * <LI>
85 * <CODE>object</CODE> is not null.
86 * <LI>
87 * <CODE>object</CODE> is an instance of class JobImpressionsSupported.
88 * <LI>
89 * This job impressions supported attribute's members and
90 * <CODE>object</CODE>'s members are the same.
91 * </OL>
92 *
93 * @param object Object to compare to.
94 *
95 * @return True if <CODE>object</CODE> is equivalent to this job
96 * impressions supported attribute, false otherwise.
97 */
98 public boolean equals(Object object) {
99 return (super.equals (object) &&
100 object instanceof JobImpressionsSupported);
101 }
102
103 /**
104 * Get the printing attribute class which is to be used as the "category"
105 * for this printing attribute value.
106 * <P>
107 * For class JobImpressionsSupported, the category is class
108 * JobImpressionsSupported itself.
109 *
110 * @return Printing attribute class (category), an instance of class
111 * {@link java.lang.Class java.lang.Class}.
112 */
113 public final Class<? extends Attribute> getCategory() {
114 return JobImpressionsSupported.class;
115 }
116
117 /**
118 * Get the name of the category of which this attribute value is an
119 * instance.
120 * <P>
121 * For class JobImpressionsSupported, the category name is
122 * <CODE>"job-impressions-supported"</CODE>.
123 *
124 * @return Attribute category name.
125 */
126 public final String getName() {
127 return "job-impressions-supported";
128 }
129
130}