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/JobKOctetsProcessed.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
34
/**
35
* Class {@code JobKOctetsProcessed} is an integer valued printing attribute
36
* class that specifies the total number of print data octets processed so far
37
* in K octets, i.e., in units of 1024 octets. The value must be rounded up, so
38
* that a job between 1 and 1024 octets inclusive must be indicated as being 1K
39
* octets, 1025 to 2048 inclusive must be 2K, etc. For a multidoc print job (a
40
* job with multiple documents), the JobKOctetsProcessed value is computed by
41
* adding up the individual documents' number of octets processed so far, then
42
* rounding up to the next K octets value.
43
* <p>
44
* The {@code JobKOctetsProcessed} attribute describes the progress of the job.
45
* This attribute is intended to be a counter. That is, the JobKOctetsProcessed
46
* value for a job that has not started processing must be 0. When the job's
47
* {@link JobState JobState} is {@code PROCESSING} or
48
* {@code PROCESSING_STOPPED}, the {@code JobKOctetsProcessed} value is intended
49
* to increase as the job is processed; it indicates the amount of the job that
50
* has been processed at the time the Print Job's attribute set is queried or at
51
* the time a print job event is reported. When the job enters the
52
* {@code COMPLETED}, {@code CANCELED}, or {@code ABORTED} states, the
53
* {@code JobKOctetsProcessed} value is the final value for the job.
54
* <p>
55
* For implementations where multiple copies are produced by the interpreter
56
* with only a single pass over the data, the final value of the
57
* JobKOctetsProcessed attribute must be equal to the value of the
58
* {@link JobKOctets JobKOctets} attribute. For implementations where multiple
59
* copies are produced by the interpreter by processing the data for each copy,
60
* the final value must be a multiple of the value of the
61
* {@link JobKOctets JobKOctets} attribute.
62
* <p>
63
* <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The
64
* category name returned by {@code getName()} gives the IPP attribute name.
65
*
66
* @author Alan Kaminsky
67
* @see JobKOctets
68
* @see JobKOctetsSupported
69
* @see JobImpressionsCompleted
70
* @see JobMediaSheetsCompleted
71
*/
72
public final class JobKOctetsProcessed extends IntegerSyntax
73
implements PrintJobAttribute {
74
75
/**
76
* Use serialVersionUID from JDK 1.4 for interoperability.
77
*/
78
@Serial
79
private static final long serialVersionUID = -6265238509657881806L;
80
81
/**
82
* Construct a new job K octets processed attribute with the given integer
83
* value.
84
*
85
* @param value Integer value
86
* @throws IllegalArgumentException if {@code value} is negative
87
*/
88
public JobKOctetsProcessed(int value) {
89
super (value, 0, Integer.MAX_VALUE);
90
}
91
92
/**
93
* Returns whether this job K octets processed attribute is equivalent to
94
* the passed in object. To be equivalent, all of the following conditions
95
* must be true:
96
* <ol type=1>
97
* <li>{@code object} is not {@code null}.
98
* <li>{@code object} is an instance of class {@code JobKOctetsProcessed}.
99
* <li>This job K octets processed attribute's value and {@code object}'s
100
* value are equal.
101
* </ol>
102
*
103
* @param object {@code Object} to compare to
104
* @return {@code true} if {@code object} is equivalent to this job K octets
105
* processed attribute, {@code false} otherwise
106
*/
107
public boolean equals(Object object) {
108
return(super.equals (object) &&
109
object instanceof JobKOctetsProcessed);
110
}
111
112
/**
113
* Get the printing attribute class which is to be used as the "category"
114
* for this printing attribute value.
115
* <p>
116
* For class {@code JobKOctetsProcessed}, the category is class
117
* {@code JobKOctetsProcessed} itself.
118
*
119
* @return printing attribute class (category), an instance of class
120
* {@link Class java.lang.Class}
121
*/
122
public final Class<? extends Attribute> getCategory() {
123
return JobKOctetsProcessed.class;
124
}
125
126
/**
127
* Get the name of the category of which this attribute value is an
128
* instance.
129
* <p>
130
* For class {@code JobKOctetsProcessed}, the category name is
131
* {@code "job-k-octets-processed"}.
132
*
133
* @return attribute category name
134
*/
135
public final String getName() {
136
return "job-k-octets-processed";
137
}
138
}
139
140