Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/print/attribute/standard/JobKOctetsProcessed.java
38918 views
/*1* Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/24package javax.print.attribute.standard;2526import javax.print.attribute.Attribute;27import javax.print.attribute.IntegerSyntax;28import javax.print.attribute.PrintJobAttribute;2930/**31* Class JobKOctetsProcessed is an integer valued printing attribute class that32* specifies the total number of print data octets processed so far in K octets,33* i.e., in units of 1024 octets. The value must be rounded up, so that a job34* between 1 and 1024 octets inclusive must be indicated as being 1K octets,35* 1025 to 2048 inclusive must be 2K, etc. For a multidoc print job (a job with36* multiple documents), the JobKOctetsProcessed value is computed by adding up37* the individual documents' number of octets processed so far, then rounding up38* to the next K octets value.39* <P>40* The JobKOctetsProcessed attribute describes the progress of the job. This41* attribute is intended to be a counter. That is, the JobKOctetsProcessed value42* for a job that has not started processing must be 0. When the job's {@link43* JobState JobState} is PROCESSING or PROCESSING_STOPPED, the44* JobKOctetsProcessed value is intended to increase as the job is processed; it45* indicates the amount of the job that has been processed at the time the Print46* Job's attribute set is queried or at the time a print job event is reported.47* When the job enters the COMPLETED, CANCELED, or ABORTED states, the48* JobKOctetsProcessed value is the final value for the job.49* <P>50* For implementations where multiple copies are produced by the interpreter51* with only a single pass over the data, the final value of the52* JobKOctetsProcessed attribute must be equal to the value of the {@link53* JobKOctets JobKOctets} attribute. For implementations where multiple copies54* are produced by the interpreter by processing the data for each copy, the55* final value must be a multiple of the value of the {@link JobKOctets56* JobKOctets} attribute.57* <P>58* <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The59* category name returned by <CODE>getName()</CODE> gives the IPP attribute60* name.61* <P>62*63* @see JobKOctets64* @see JobKOctetsSupported65* @see JobImpressionsCompleted66* @see JobMediaSheetsCompleted67*68* @author Alan Kaminsky69*/70public final class JobKOctetsProcessed extends IntegerSyntax71implements PrintJobAttribute {7273private static final long serialVersionUID = -6265238509657881806L;7475/**76* Construct a new job K octets processed attribute with the given integer77* value.78*79* @param value Integer value.80*81* @exception IllegalArgumentException82* (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0.83*/84public JobKOctetsProcessed(int value) {85super (value, 0, Integer.MAX_VALUE);86}8788/**89* Returns whether this job K octets processed attribute is equivalent to90* the passed in object. To be equivalent, all of the following conditions91* must be true:92* <OL TYPE=1>93* <LI>94* <CODE>object</CODE> is not null.95* <LI>96* <CODE>object</CODE> is an instance of class JobKOctetsProcessed.97* <LI>98* This job K octets processed attribute's value and99* <CODE>object</CODE>'s value are equal.100* </OL>101*102* @param object Object to compare to.103*104* @return True if <CODE>object</CODE> is equivalent to this job K105* octets processed attribute, false otherwise.106*/107public boolean equals(Object object) {108return(super.equals (object) &&109object instanceof JobKOctetsProcessed);110}111112/**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 JobKOctetsProcessed, the category is class117* JobKOctetsProcessed itself.118*119* @return Printing attribute class (category), an instance of class120* {@link java.lang.Class java.lang.Class}.121*/122public final Class<? extends Attribute> getCategory() {123return JobKOctetsProcessed.class;124}125126/**127* Get the name of the category of which this attribute value is an128* instance.129* <P>130* For class JobKOctetsProcessed, the category name is131* <CODE>"job-k-octets-processed"</CODE>.132*133* @return Attribute category name.134*/135public final String getName() {136return "job-k-octets-processed";137}138139}140141142