KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)NumberOfDocuments.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.IntegerSyntax JavaDoc;
11 import javax.print.attribute.PrintJobAttribute JavaDoc;
12
13 /**
14  * Class NumberOfDocuments is an integer valued printing attribute that
15  * indicates the number of individual docs the printer has accepted for this
16  * job, regardless of whether the docs' print data has reached the printer or
17  * not.
18  * <P>
19  * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
20  * category name returned by <CODE>getName()</CODE> gives the IPP attribute
21  * name.
22  * <P>
23  *
24  * @author Alan Kaminsky
25  */

26 public final class NumberOfDocuments extends IntegerSyntax JavaDoc
27     implements PrintJobAttribute JavaDoc {
28
29     private static final long serialVersionUID = 7891881310684461097L;
30
31
32     /**
33      * Construct a new number of documents attribute with the given integer
34      * value.
35      *
36      * @param value Integer value.
37      *
38      * @exception IllegalArgumentException
39      * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0.
40      */

41     public NumberOfDocuments(int value) {
42     super (value, 0, Integer.MAX_VALUE);
43     }
44
45     /**
46      * Returns whether this number of documents attribute is equivalent to the
47      * passed in object. To be equivalent, all of the following conditions
48      * must be true:
49      * <OL TYPE=1>
50      * <LI>
51      * <CODE>object</CODE> is not null.
52      * <LI>
53      * <CODE>object</CODE> is an instance of class NumberOfDocuments.
54      * <LI>
55      * This number of documents attribute's value and <CODE>object</CODE>'s
56      * value are equal.
57      * </OL>
58      *
59      * @param object Object to compare to.
60      *
61      * @return True if <CODE>object</CODE> is equivalent to this number of
62      * documents attribute, false otherwise.
63      */

64     public boolean equals(Object JavaDoc object) {
65     return (super.equals (object) &&
66         object instanceof NumberOfDocuments JavaDoc);
67     }
68
69     /**
70      * Get the printing attribute class which is to be used as the "category"
71      * for this printing attribute value.
72      * <P>
73      * For class NumberOfDocuments, the
74      * category is class NumberOfDocuments itself.
75      *
76      * @return Printing attribute class (category), an instance of class
77      * {@link java.lang.Class java.lang.Class}.
78      */

79     public final Class JavaDoc<? extends Attribute JavaDoc> getCategory() {
80     return NumberOfDocuments JavaDoc.class;
81     }
82
83     /**
84      * Get the name of the category of which this attribute value is an
85      * instance.
86      * <P>
87      * For class NumberOfDocuments, the
88      * category name is <CODE>"number-of-documents"</CODE>.
89      *
90      * @return Attribute category name.
91      */

92     public final String JavaDoc getName() {
93     return "number-of-documents";
94     }
95     
96 }
97
Popular Tags