Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/share/classes/javax/print/attribute/standard/Copies.java
41171 views
1
/*
2
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. 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. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package javax.print.attribute.standard;
27
28
import java.io.Serial;
29
30
import javax.print.attribute.Attribute;
31
import javax.print.attribute.IntegerSyntax;
32
import javax.print.attribute.PrintJobAttribute;
33
import javax.print.attribute.PrintRequestAttribute;
34
35
/**
36
* Class {@code Copies} is an integer valued printing attribute class that
37
* specifies the number of copies to be printed.
38
* <p>
39
* On many devices the supported number of collated copies will be limited by
40
* the number of physical output bins on the device, and may be different from
41
* the number of uncollated copies which can be supported.
42
* <p>
43
* The effect of a {@code Copies} attribute with a value of <i>n</i> on a
44
* multidoc print job (a job with multiple documents) depends on the (perhaps
45
* defaulted) value of the
46
* {@link MultipleDocumentHandling MultipleDocumentHandling} attribute:
47
* <ul>
48
* <li>{@code SINGLE_DOCUMENT} -- The result will be <i>n</i> copies of a
49
* single output document comprising all the input docs.
50
* <li>{@code SINGLE_DOCUMENT_NEW_SHEET} -- The result will be <i>n</i> copies
51
* of a single output document comprising all the input docs, and the first
52
* impression of each input doc will always start on a new media sheet.
53
* <li>{@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- The result will be
54
* <i>n</i> copies of the first input document, followed by <i>n</i> copies of
55
* the second input document, . . . followed by <i>n</i> copies of the last
56
* input document.
57
* <li>{@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- The result will be the
58
* first input document, the second input document, . . . the last input
59
* document, the group of documents being repeated <i>n</i> times.
60
* </ul>
61
* <p>
62
* <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The
63
* category name returned by {@code getName()} gives the IPP attribute name.
64
*
65
* @author David Mendenhall
66
* @author Alan Kamihensky
67
*/
68
public final class Copies extends IntegerSyntax
69
implements PrintRequestAttribute, PrintJobAttribute {
70
71
/**
72
* Use serialVersionUID from JDK 1.4 for interoperability.
73
*/
74
@Serial
75
private static final long serialVersionUID = -6426631521680023833L;
76
77
/**
78
* Construct a new copies attribute with the given integer value.
79
*
80
* @param value Integer value
81
* @throws IllegalArgumentException if {@code value < 1}
82
*/
83
public Copies(int value) {
84
super (value, 1, Integer.MAX_VALUE);
85
}
86
87
/**
88
* Returns whether this copies attribute is equivalent to the passed in
89
* object. To be equivalent, all of the following conditions must be true:
90
* <ol type=1>
91
* <li>{@code object} is not {@code null}.
92
* <li>{@code object} is an instance of class {@code Copies}.
93
* <li>This copies attribute's value and {@code object}'s value are equal.
94
* </ol>
95
*
96
* @param object {@code Object} to compare to
97
* @return {@code true} if {@code object} is equivalent to this copies
98
* attribute, {@code false} otherwise
99
*/
100
public boolean equals(Object object) {
101
return super.equals (object) && object instanceof Copies;
102
}
103
104
/**
105
* Get the printing attribute class which is to be used as the "category"
106
* for this printing attribute value.
107
* <p>
108
* For class {@code Copies}, the category is class {@code Copies} itself.
109
*
110
* @return printing attribute class (category), an instance of class
111
* {@link Class java.lang.Class}
112
*/
113
public final Class<? extends Attribute> getCategory() {
114
return Copies.class;
115
}
116
117
/**
118
* Get the name of the category of which this attribute value is an
119
* instance.
120
* <p>
121
* For class {@code Copies}, the category name is {@code "copies"}.
122
*
123
* @return attribute category name
124
*/
125
public final String getName() {
126
return "copies";
127
}
128
}
129
130