KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)JobKOctetsSupported.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 JobKOctetsSupported is a printing attribute class, a set of integers,
15  * that gives the supported values for a {@link JobKOctets JobKOctets}
16  * attribute. It is restricted to a single contiguous range of integers;
17  * multiple non-overlapping ranges are not allowed. This gives the lower and
18  * upper bounds of the total sizes of print jobs in units of K octets (1024
19  * octets) that the printer will accept.
20  * <P>
21  * <B>IPP Compatibility:</B> The JobKOctetsSupported attribute's canonical array
22  * form gives the lower and upper bound for the range of values to be included
23  * in an IPP "job-k-octets-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 JobKOctetsSupported extends SetOfIntegerSyntax JavaDoc
32     implements SupportedValuesAttribute JavaDoc {
33
34     private static final long serialVersionUID = -2867871140549897443L;
35
36     /**
37      * Construct a new job K octets supported attribute containing a single
38      * range of integers. That is, only those values of JobKOctets in the one
39      * range are supported.
40      *
41      * @param lowerBound Lower bound of the range.
42      * @param upperBound Upper bound of the range.
43      *
44      * @exception IllegalArgumentException
45      * (Unchecked exception) Thrown if a null range is specified or if a
46      * non-null range is specified with <CODE>lowerBound</CODE> less than
47      * 0.
48      */

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

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

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

106     public final String JavaDoc getName() {
107     return "job-k-octets-supported";
108     }
109
110 }
111
Popular Tags