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/NumberUp.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.DocAttribute;
32
import javax.print.attribute.IntegerSyntax;
33
import javax.print.attribute.PrintJobAttribute;
34
import javax.print.attribute.PrintRequestAttribute;
35
36
/**
37
* Class {@code NumberUp} is an integer valued printing attribute class that
38
* specifies the number of print-stream pages to impose upon a single side of an
39
* instance of a selected medium. That is, if the NumberUp value is <i>n,</i>
40
* the printer must place <i>n</i> print-stream pages on a single side of an
41
* instance of the selected medium. To accomplish this, the printer may add some
42
* sort of translation, scaling, or rotation. This attribute primarily controls
43
* the translation, scaling and rotation of print-stream pages.
44
* <p>
45
* The effect of a {@code NumberUp} attribute on a multidoc print job (a job
46
* with multiple documents) depends on whether all the docs have the same number
47
* up values specified or whether different docs have different number up values
48
* specified, and on the (perhaps defaulted) value of the
49
* {@link MultipleDocumentHandling MultipleDocumentHandling} attribute.
50
* <ul>
51
* <li>If all the docs have the same number up value <i>n</i> specified, then
52
* any value of {@link MultipleDocumentHandling MultipleDocumentHandling}
53
* makes sense, and the printer's processing depends on the
54
* {@link MultipleDocumentHandling MultipleDocumentHandling} value:
55
* <ul>
56
* <li>{@code SINGLE_DOCUMENT} -- All the input docs will be combined
57
* together into one output document. Each media impression will consist of
58
* <i>n</i>m print-stream pages from the output document.
59
* <li>{@code SINGLE_DOCUMENT_NEW_SHEET} -- All the input docs will be
60
* combined together into one output document. Each media impression will
61
* consist of <i>n</i> print-stream pages from the output document. However,
62
* the first impression of each input doc will always start on a new media
63
* sheet; this means the last impression of an input doc may have fewer than
64
* <i>n</i> print-stream pages on it.
65
* <li>{@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- The input docs will
66
* remain separate. Each media impression will consist of <i>n</i>
67
* print-stream pages from the input doc. Since the input docs are separate,
68
* the first impression of each input doc will always start on a new media
69
* sheet; this means the last impression of an input doc may have fewer than
70
* <i>n</i> print-stream pages on it.
71
* <li>{@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- The input docs will
72
* remain separate. Each media impression will consist of <i>n</i>
73
* print-stream pages from the input doc. Since the input docs are separate,
74
* the first impression of each input doc will always start on a new media
75
* sheet; this means the last impression of an input doc may have fewer than
76
* <i>n</i> print-stream pages on it.
77
* </ul>
78
* <ul>
79
* <li>{@code SINGLE_DOCUMENT} -- All the input docs will be combined
80
* together into one output document. Each media impression will consist of
81
* <i>n<sub>i</sub></i> print-stream pages from the output document, where
82
* <i>i</i> is the number of the input doc corresponding to that point in
83
* the output document. When the next input doc has a different number up
84
* value from the previous input doc, the first print-stream page of the
85
* next input doc goes at the start of the next media impression, possibly
86
* leaving fewer than the full number of print-stream pages on the previous
87
* media impression.
88
* <li>{@code SINGLE_DOCUMENT_NEW_SHEET} -- All the input docs will be
89
* combined together into one output document. Each media impression will
90
* consist of <i>n</i> print-stream pages from the output document. However,
91
* the first impression of each input doc will always start on a new media
92
* sheet; this means the last impression of an input doc may have fewer than
93
* <i>n</i> print-stream pages on it.
94
* <li>{@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- The input docs will
95
* remain separate. For input doc <i>i,</i> each media impression will
96
* consist of <i>n<sub>i</sub></i> print-stream pages from the input doc.
97
* Since the input docs are separate, the first impression of each input doc
98
* will always start on a new media sheet; this means the last impression of
99
* an input doc may have fewer than <i>n<sub>i</sub></i> print-stream pages
100
* on it.
101
* <li>{@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- The input docs will
102
* remain separate. For input doc <i>i,</i> each media impression will
103
* consist of <i>n<sub>i</sub></i> print-stream pages from the input doc.
104
* Since the input docs are separate, the first impression of each input doc
105
* will always start on a new media sheet; this means the last impression of
106
* an input doc may have fewer than <i>n<sub>i</sub></i> print-stream pages
107
* on it.
108
* </ul>
109
* </ul>
110
* <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The
111
* category name returned by {@code getName()} gives the IPP attribute name.
112
*
113
* @author Alan Kaminsky
114
*/
115
public final class NumberUp extends IntegerSyntax
116
implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
117
118
/**
119
* Use serialVersionUID from JDK 1.4 for interoperability.
120
*/
121
@Serial
122
private static final long serialVersionUID = -3040436486786527811L;
123
124
/**
125
* Construct a new number up attribute with the given integer value.
126
*
127
* @param value Integer value
128
* @throws IllegalArgumentException if {@code value < 1}
129
*/
130
public NumberUp(int value) {
131
super (value, 1, Integer.MAX_VALUE);
132
}
133
134
/**
135
* Returns whether this number up attribute is equivalent to the passed in
136
* object. To be equivalent, all of the following conditions must be true:
137
* <ol type=1>
138
* <li>{@code object} is not {@code null}.
139
* <li>{@code object} is an instance of class {@code NumberUp}.
140
* <li>This number up attribute's value and {@code object}'s value are
141
* equal.
142
* </ol>
143
*
144
* @param object {@code Object} to compare to
145
* @return {@code true} if {@code object} is equivalent to this number up
146
* attribute, {@code false} otherwise
147
*/
148
public boolean equals(Object object) {
149
return (super.equals(object) && object instanceof NumberUp);
150
}
151
152
/**
153
* Get the printing attribute class which is to be used as the "category"
154
* for this printing attribute value.
155
* <p>
156
* For class {@code NumberUp}, the category is class {@code NumberUp}
157
* itself.
158
*
159
* @return printing attribute class (category), an instance of class
160
* {@link Class java.lang.Class}
161
*/
162
public final Class<? extends Attribute> getCategory() {
163
return NumberUp.class;
164
}
165
166
/**
167
* Get the name of the category of which this attribute value is an
168
* instance.
169
* <p>
170
* For class {@code NumberUp}, the category name is {@code "number-up"}.
171
*
172
* @return attribute category name
173
*/
174
public final String getName() {
175
return "number-up";
176
}
177
}
178
179