blob: 2631e8f3c02f29ff108fa1417c31cdbea395eeff [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.IntegerSyntax;
29import javax.print.attribute.PrintJobAttribute;
30
31/**
32 * Class NumberOfDocuments is an integer valued printing attribute that
33 * indicates the number of individual docs the printer has accepted for this
34 * job, regardless of whether the docs' print data has reached the printer or
35 * not.
36 * <P>
37 * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
38 * category name returned by <CODE>getName()</CODE> gives the IPP attribute
39 * name.
40 * <P>
41 *
42 * @author Alan Kaminsky
43 */
44public final class NumberOfDocuments extends IntegerSyntax
45 implements PrintJobAttribute {
46
47 private static final long serialVersionUID = 7891881310684461097L;
48
49
50 /**
51 * Construct a new number of documents attribute with the given integer
52 * value.
53 *
54 * @param value Integer value.
55 *
56 * @exception IllegalArgumentException
57 * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0.
58 */
59 public NumberOfDocuments(int value) {
60 super (value, 0, Integer.MAX_VALUE);
61 }
62
63 /**
64 * Returns whether this number of documents attribute is equivalent to the
65 * passed in object. To be equivalent, all of the following conditions
66 * must be true:
67 * <OL TYPE=1>
68 * <LI>
69 * <CODE>object</CODE> is not null.
70 * <LI>
71 * <CODE>object</CODE> is an instance of class NumberOfDocuments.
72 * <LI>
73 * This number of documents attribute's value and <CODE>object</CODE>'s
74 * value are equal.
75 * </OL>
76 *
77 * @param object Object to compare to.
78 *
79 * @return True if <CODE>object</CODE> is equivalent to this number of
80 * documents attribute, false otherwise.
81 */
82 public boolean equals(Object object) {
83 return (super.equals (object) &&
84 object instanceof NumberOfDocuments);
85 }
86
87 /**
88 * Get the printing attribute class which is to be used as the "category"
89 * for this printing attribute value.
90 * <P>
91 * For class NumberOfDocuments, the
92 * category is class NumberOfDocuments itself.
93 *
94 * @return Printing attribute class (category), an instance of class
95 * {@link java.lang.Class java.lang.Class}.
96 */
97 public final Class<? extends Attribute> getCategory() {
98 return NumberOfDocuments.class;
99 }
100
101 /**
102 * Get the name of the category of which this attribute value is an
103 * instance.
104 * <P>
105 * For class NumberOfDocuments, the
106 * category name is <CODE>"number-of-documents"</CODE>.
107 *
108 * @return Attribute category name.
109 */
110 public final String getName() {
111 return "number-of-documents";
112 }
113
114}