KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > print > attribute > standard > JobImpressionsSupported


1 /*
2  * @(#)JobImpressionsSupported.java 1.7 04/05/05
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 package javax.print.attribute.standard;
8
9 import javax.print.attribute.Attribute JavaDoc;
10 import javax.print.attribute.SetOfIntegerSyntax JavaDoc;
11 import javax.print.attribute.SupportedValuesAttribute JavaDoc;
12
13 /**
14  * Class JobImpressionsSupported is a printing attribute class, a set of
15  * integers, that gives the supported values for a {@link JobImpressions
16  * JobImpressions} attribute. It is restricted to a single contiguous range of
17  * integers; multiple non-overlapping ranges are not allowed. This gives the
18  * lower and upper bounds of the total sizes of print jobs in number of
19  * impressions that the printer will accept.
20  * <P>
21  * <B>IPP Compatibility:</B> The JobImpressionsSupported attribute's canonical
22  * array form gives the lower and upper bound for the range of values to be
23  * included in an IPP "job-impressions-supported" attribute. See class {@link
24  * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an
25  * explanation of canonical array form. The category name returned by
26  * <CODE>getName()</CODE> gives the IPP attribute name.
27  * <P>
28  *
29  * @author Alan Kaminsky
30  */

31 public final class JobImpressionsSupported extends SetOfIntegerSyntax JavaDoc
32     implements SupportedValuesAttribute JavaDoc {
33
34     private static final long serialVersionUID = -4887354803843173692L;
35
36
37     /**
38      * Construct a new job impressions supported attribute containing a single
39      * range of integers. That is, only those values of JobImpressions in the
40      * one range are supported.
41      *
42      * @param lowerBound Lower bound of the range.
43      * @param upperBound Upper bound of the range.
44      *
45      * @exception IllegalArgumentException
46      * (Unchecked exception) Thrown if a null range is specified or if a
47      * non-null range is specified with <CODE>lowerBound</CODE> less than
48      * 0.
49      */

50     public JobImpressionsSupported(int lowerBound, int upperBound) {
51     super (lowerBound, upperBound);
52     if (lowerBound > upperBound) {
53         throw new IllegalArgumentException JavaDoc("Null range specified");
54     } else if (lowerBound < 0) {
55         throw new IllegalArgumentException JavaDoc(
56                      "Job K octets value < 0 specified");
57     }
58     }
59
60
61     /**
62      * Returns whether this job impressions supported attribute is equivalent
63      * to the passed in object. To be equivalent, all of the following
64      * conditions must be true:
65      * <OL TYPE=1>
66      * <LI>
67      * <CODE>object</CODE> is not null.
68      * <LI>
69      * <CODE>object</CODE> is an instance of class JobImpressionsSupported.
70      * <LI>
71      * This job impressions supported attribute's members and
72      * <CODE>object</CODE>'s members are the same.
73      * </OL>
74      *
75      * @param object Object to compare to.
76      *
77      * @return True if <CODE>object</CODE> is equivalent to this job
78      * impressions supported attribute, false otherwise.
79      */

80     public boolean equals(Object JavaDoc object) {
81     return (super.equals (object) &&
82         object instanceof JobImpressionsSupported JavaDoc);
83     }
84
85     /**
86      * Get the printing attribute class which is to be used as the "category"
87      * for this printing attribute value.
88      * <P>
89      * For class JobImpressionsSupported, the category is class
90      * JobImpressionsSupported itself.
91      *
92      * @return Printing attribute class (category), an instance of class
93      * {@link java.lang.Class java.lang.Class}.
94      */

95     public final Class JavaDoc<? extends Attribute JavaDoc> getCategory() {
96     return JobImpressionsSupported JavaDoc.class;
97     }
98
99     /**
100      * Get the name of the category of which this attribute value is an
101      * instance.
102      * <P>
103      * For class JobImpressionsSupported, the category name is
104      * <CODE>"job-impressions-supported"</CODE>.
105      *
106      * @return Attribute category name.
107      */

108     public final String JavaDoc getName() {
109     return "job-impressions-supported";
110     }
111     
112 }
113
Popular Tags