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