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/JobMediaSheets.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 JobMediaSheets} is an integer valued printing attribute class
37
* that specifies the total number of media sheets to be produced for this job.
38
* <p>
39
* The {@code JobMediaSheets} attribute describes the size of the job. This
40
* attribute is not intended to be a counter; it is intended to be useful
41
* routing and scheduling information if known. The printer may try to compute
42
* the {@code JobMediaSheets} attribute's value if it is not supplied in the
43
* Print Request. Even if the client does supply a value for the
44
* {@code JobMediaSheets} attribute in the Print Request, the printer may choose
45
* to change the value if the printer is able to compute a value which is more
46
* accurate than the client supplied value. The printer may be able to determine
47
* the correct value for the {@code JobMediaSheets} attribute either right at
48
* job submission time or at any later point in time.
49
* <p>
50
* Unlike the {@link JobKOctets JobKOctets} and
51
* {@link JobImpressions JobImpressions} attributes, the {@code JobMediaSheets}
52
* value must include the multiplicative factors contributed by the number of
53
* copies specified by the {@link Copies Copies} attribute and a "number of
54
* copies" instruction embedded in the document data, if any. This difference
55
* allows the system administrator to control the lower and upper bounds of both
56
* (1) the size of the document(s) with
57
* {@link JobKOctetsSupported JobKOctetsSupported} and
58
* {@link JobImpressionsSupported JobImpressionsSupported} and (2) the size of
59
* the job with {@link JobMediaSheetsSupported JobMediaSheetsSupported}.
60
* <p>
61
* <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The
62
* category name returned by {@code getName()} gives the IPP attribute name.
63
*
64
* @author Alan Kaminsky
65
* @see JobMediaSheetsSupported
66
* @see JobMediaSheetsCompleted
67
* @see JobKOctets
68
* @see JobImpressions
69
*/
70
public class JobMediaSheets extends IntegerSyntax
71
implements PrintRequestAttribute, PrintJobAttribute {
72
73
/**
74
* Use serialVersionUID from JDK 1.4 for interoperability.
75
*/
76
@Serial
77
private static final long serialVersionUID = 408871131531979741L;
78
79
/**
80
* Construct a new job media sheets attribute with the given integer value.
81
*
82
* @param value Integer value
83
* @throws IllegalArgumentException if {@code value} is negative
84
*/
85
public JobMediaSheets(int value) {
86
super (value, 0, Integer.MAX_VALUE);
87
}
88
89
/**
90
* Returns whether this job media sheets attribute is equivalent to the
91
* passed in object. To be equivalent, all of the following conditions must
92
* be true:
93
* <ol type=1>
94
* <li>{@code object} is not {@code null}.
95
* <li>{@code object} is an instance of class {@code JobMediaSheets}.
96
* <li>This job media sheets attribute's value and {@code object}'s value
97
* are equal.
98
* </ol>
99
*
100
* @param object {@code Object} to compare to
101
* @return {@code true} if {@code object} is equivalent to this job media
102
* sheets attribute, {@code false} otherwise
103
*/
104
public boolean equals(Object object) {
105
return super.equals(object) && object instanceof JobMediaSheets;
106
}
107
108
/**
109
* Get the printing attribute class which is to be used as the "category"
110
* for this printing attribute value.
111
* <p>
112
* For class {@code JobMediaSheets} and any vendor-defined subclasses, the
113
* category is class {@code JobMediaSheets} itself.
114
*
115
* @return printing attribute class (category), an instance of class
116
* {@link Class java.lang.Class}
117
*/
118
public final Class<? extends Attribute> getCategory() {
119
return JobMediaSheets.class;
120
}
121
122
/**
123
* Get the name of the category of which this attribute value is an
124
* instance.
125
* <p>
126
* For class {@code JobMediaSheets} and any vendor-defined subclasses, the
127
* category name is {@code "job-media-sheets"}.
128
*
129
* @return attribute category name
130
*/
131
public final String getName() {
132
return "job-media-sheets";
133
}
134
}
135
136