KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)JobMediaSheetsSupported.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 JobMediaSheetsSupported is a printing attribute class, a set of
15  * integers, that gives the supported values for a {@link JobMediaSheets
16  * JobMediaSheets} 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 media
19  * sheets that the printer will accept.
20  * <P>
21  * <B>IPP Compatibility:</B> The JobMediaSheetsSupported 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-media-sheets-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 JobMediaSheetsSupported extends SetOfIntegerSyntax JavaDoc
32     implements SupportedValuesAttribute JavaDoc {
33
34     private static final long serialVersionUID = 2953685470388672940L;
35
36     /**
37      * Construct a new job media sheets supported attribute containing a single
38      * range of integers. That is, only those values of JobMediaSheets in the
39      * one 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 JobMediaSheetsSupported(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 media sheets supported attribute is equivalent
61      * to the passed in object. To be equivalent, all of the following
62      * conditions 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 JobMediaSheetsSupported.
68      * <LI>
69      * This job media sheets 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 media
76      * sheets supported attribute, false otherwise.
77      */

78     public boolean equals(Object JavaDoc object) {
79     return (super.equals (object) &&
80         object instanceof JobMediaSheetsSupported 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 JobMediaSheetsSupported, the
88      * category is class JobMediaSheetsSupported 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 JobMediaSheetsSupported 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 JobMediaSheetsSupported, the
102      * category name is <CODE>"job-media-sheets-supported"</CODE>.
103      *
104      * @return Attribute category name.
105      */

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