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/JobImpressions.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 JobImpressions} is an integer valued printing attribute class
37
* that specifies the total size in number of impressions of the document(s)
38
* being submitted. An "impression" is the image (possibly many print-stream
39
* pages in different configurations) imposed onto a single media page.
40
* <p>
41
* The {@code JobImpressions} attribute describes the size of the job. This
42
* attribute is not intended to be a counter; it is intended to be useful
43
* routing and scheduling information if known. The printer may try to compute
44
* the {@code JobImpressions} attribute's value if it is not supplied in the
45
* Print Request. Even if the client does supply a value for the
46
* {@code JobImpressions} attribute in the Print Request, the printer may choose
47
* to change the value if the printer is able to compute a value which is more
48
* accurate than the client supplied value. The printer may be able to determine
49
* the correct value for the {@code JobImpressions} attribute either right at
50
* job submission time or at any later point in time.
51
* <p>
52
* As with {@link JobKOctets JobKOctets}, the {@code JobImpressions} value must
53
* not include the multiplicative factors contributed by the number of copies
54
* specified by the {@link Copies Copies} attribute, independent of whether the
55
* device can process multiple copies without making multiple passes over the
56
* job or document data and independent of whether the output is collated or
57
* not. Thus the value is independent of the implementation and reflects the
58
* size of the document(s) measured in impressions independent of the number of
59
* copies.
60
* <p>
61
* As with {@link JobKOctets JobKOctets}, the {@code JobImpressions} value must
62
* also not include the multiplicative factor due to a copies instruction
63
* embedded in the document data. If the document data actually includes
64
* replications of the document data, this value will include such replication.
65
* In other words, this value is always the number of impressions in the source
66
* document data, rather than a measure of the number of impressions to be
67
* produced by the job.
68
* <p>
69
* <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The
70
* category name returned by {@code getName()} gives the IPP attribute name.
71
*
72
* @author Alan Kaminsky
73
* @see JobImpressionsSupported
74
* @see JobImpressionsCompleted
75
* @see JobKOctets
76
* @see JobMediaSheets
77
*/
78
public final class JobImpressions extends IntegerSyntax
79
implements PrintRequestAttribute, PrintJobAttribute {
80
81
/**
82
* Use serialVersionUID from JDK 1.4 for interoperability.
83
*/
84
@Serial
85
private static final long serialVersionUID = 8225537206784322464L;
86
87
/**
88
* Construct a new job impressions attribute with the given integer value.
89
*
90
* @param value Integer value
91
* @throws IllegalArgumentException if {@code value} is negative
92
*
93
*/
94
public JobImpressions(int value) {
95
super(value, 0, Integer.MAX_VALUE);
96
}
97
98
/**
99
* Returns whether this job impressions attribute is equivalent to the
100
* passed in object. To be equivalent, all of the following conditions must
101
* be true:
102
* <ol type=1>
103
* <li>{@code object} is not {@code null}.
104
* <li>{@code object} is an instance of class {@code JobImpressions}.
105
* <li>This job impressions attribute's value and {@code object}'s value
106
* are equal.
107
* </ol>
108
*
109
* @param object {@code Object} to compare to
110
* @return {@code true} if {@code object} is equivalent to this job
111
* impressions attribute, {@code false} otherwise
112
*/
113
public boolean equals(Object object) {
114
return super.equals (object) && object instanceof JobImpressions;
115
}
116
117
/**
118
* Get the printing attribute class which is to be used as the "category"
119
* for this printing attribute value.
120
* <p>
121
* For class {@code JobImpressions}, the category is class
122
* {@code JobImpressions} itself.
123
*
124
* @return printing attribute class (category), an instance of class
125
* {@link Class java.lang.Class}
126
*/
127
public final Class<? extends Attribute> getCategory() {
128
return JobImpressions.class;
129
}
130
131
/**
132
* Get the name of the category of which this attribute value is an
133
* instance.
134
* <p>
135
* For class {@code JobImpressions}, the category name is
136
* {@code "job-impressions"}.
137
*
138
* @return attribute category name
139
*/
140
public final String getName() {
141
return "job-impressions";
142
}
143
}
144
145