KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > print > attribute > standard > JobKOctetsProcessed


1 /*
2  * @(#)JobKOctetsProcessed.java 1.7 04/05/05
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 package javax.print.attribute.standard;
8
9 import javax.print.attribute.Attribute JavaDoc;
10 import javax.print.attribute.IntegerSyntax JavaDoc;
11 import javax.print.attribute.PrintJobAttribute JavaDoc;
12
13 /**
14  * Class JobKOctetsProcessed is an integer valued printing attribute class that
15  * specifies the total number of print data octets processed so far in K octets,
16  * i.e., in units of 1024 octets. The value must be rounded up, so that a job
17  * between 1 and 1024 octets inclusive must be indicated as being 1K octets,
18  * 1025 to 2048 inclusive must be 2K, etc. For a multidoc print job (a job with
19  * multiple documents), the JobKOctetsProcessed value is computed by adding up
20  * the individual documents' number of octets processed so far, then rounding up
21  * to the next K octets value.
22  * <P>
23  * The JobKOctetsProcessed attribute describes the progress of the job. This
24  * attribute is intended to be a counter. That is, the JobKOctetsProcessed value
25  * for a job that has not started processing must be 0. When the job's {@link
26  * JobState JobState} is PROCESSING or PROCESSING_STOPPED, the
27  * JobKOctetsProcessed value is intended to increase as the job is processed; it
28  * indicates the amount of the job that has been processed at the time the Print
29  * Job's attribute set is queried or at the time a print job event is reported.
30  * When the job enters the COMPLETED, CANCELED, or ABORTED states, the
31  * JobKOctetsProcessed value is the final value for the job.
32  * <P>
33  * For implementations where multiple copies are produced by the interpreter
34  * with only a single pass over the data, the final value of the
35  * JobKOctetsProcessed attribute must be equal to the value of the {@link
36  * JobKOctets JobKOctets} attribute. For implementations where multiple copies
37  * are produced by the interpreter by processing the data for each copy, the
38  * final value must be a multiple of the value of the {@link JobKOctets
39  * JobKOctets} attribute.
40  * <P>
41  * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
42  * category name returned by <CODE>getName()</CODE> gives the IPP attribute
43  * name.
44  * <P>
45  *
46  * @see JobKOctets
47  * @see JobKOctetsSupported
48  * @see JobImpressionsCompleted
49  * @see JobMediaSheetsCompleted
50  *
51  * @author Alan Kaminsky
52  */

53 public final class JobKOctetsProcessed extends IntegerSyntax JavaDoc
54     implements PrintJobAttribute JavaDoc {
55
56     private static final long serialVersionUID = -6265238509657881806L;
57
58     /**
59      * Construct a new job K octets processed attribute with the given integer
60      * value.
61      *
62      * @param value Integer value.
63      *
64      * @exception IllegalArgumentException
65      * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0.
66      */

67     public JobKOctetsProcessed(int value) {
68     super (value, 0, Integer.MAX_VALUE);
69     }
70
71     /**
72      * Returns whether this job K octets processed attribute is equivalent to
73      * the passed in object. To be equivalent, all of the following conditions
74      * must be true:
75      * <OL TYPE=1>
76      * <LI>
77      * <CODE>object</CODE> is not null.
78      * <LI>
79      * <CODE>object</CODE> is an instance of class JobKOctetsProcessed.
80      * <LI>
81      * This job K octets processed attribute's value and
82      * <CODE>object</CODE>'s value are equal.
83      * </OL>
84      *
85      * @param object Object to compare to.
86      *
87      * @return True if <CODE>object</CODE> is equivalent to this job K
88      * octets processed attribute, false otherwise.
89      */

90     public boolean equals(Object JavaDoc object) {
91     return(super.equals (object) &&
92            object instanceof JobKOctetsProcessed JavaDoc);
93     }
94
95     /**
96      * Get the printing attribute class which is to be used as the "category"
97      * for this printing attribute value.
98      * <P>
99      * For class JobKOctetsProcessed, the category is class
100      * JobKOctetsProcessed itself.
101      *
102      * @return Printing attribute class (category), an instance of class
103      * {@link java.lang.Class java.lang.Class}.
104      */

105     public final Class JavaDoc<? extends Attribute JavaDoc> getCategory() {
106     return JobKOctetsProcessed JavaDoc.class;
107     }
108
109     /**
110      * Get the name of the category of which this attribute value is an
111      * instance.
112      * <P>
113      * For class JobKOctetsProcessed, the category name is
114      * <CODE>"job-k-octets-processed"</CODE>.
115      *
116      * @return Attribute category name.
117      */

118     public final String JavaDoc getName() {
119     return "job-k-octets-processed";
120     }
121     
122 }
123
Popular Tags