Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/print/attribute/standard/JobMediaSheets.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.PrintRequestAttribute;29import javax.print.attribute.PrintJobAttribute;3031/**32* Class JobMediaSheets is an integer valued printing attribute class that33* specifies the total number of media sheets to be produced for this job.34* <P>35* The JobMediaSheets attribute describes the size of the job. This attribute is36* not intended to be a counter; it is intended to be useful routing and37* scheduling information if known. The printer may try to compute the38* JobMediaSheets attribute's value if it is not supplied in the Print Request.39* Even if the client does supply a value for the JobMediaSheets attribute in40* the Print Request, the printer may choose to change the value if the printer41* is able to compute a value which is more accurate than the client supplied42* value. The printer may be able to determine the correct value for the43* JobMediaSheets attribute either right at job submission time or at any later44* point in time.45* <P>46* Unlike the {@link JobKOctets JobKOctets} and {@link JobImpressions47* JobImpressions} attributes, the JobMediaSheets value must include the48* multiplicative factors contributed by the number of copies specified by the49* {@link Copies Copies} attribute and a "number of copies" instruction embedded50* in the document data, if any. This difference allows the system administrator51* to control the lower and upper bounds of both (1) the size of the document(s)52* with {@link JobKOctetsSupported JobKOctetsSupported} and {@link53* JobImpressionsSupported JobImpressionsSupported} and (2) the size of the job54* with {@link JobMediaSheetsSupported JobMediaSheetsSupported}.55* <P>56* <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The57* category name returned by <CODE>getName()</CODE> gives the IPP attribute58* name.59* <P>60*61* @see JobMediaSheetsSupported62* @see JobMediaSheetsCompleted63* @see JobKOctets64* @see JobImpressions65*66* @author Alan Kaminsky67*/68public class JobMediaSheets extends IntegerSyntax69implements PrintRequestAttribute, PrintJobAttribute {707172private static final long serialVersionUID = 408871131531979741L;7374/**75* Construct a new job media sheets attribute with the given integer76* value.77*78* @param value Integer value.79*80* @exception IllegalArgumentException81* (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0.82*/83public JobMediaSheets(int value) {84super (value, 0, Integer.MAX_VALUE);85}8687/**88* Returns whether this job media sheets attribute is equivalent to the89* passed in object. To be equivalent, all of the following conditions must90* be true:91* <OL TYPE=1>92* <LI>93* <CODE>object</CODE> is not null.94* <LI>95* <CODE>object</CODE> is an instance of class JobMediaSheets.96* <LI>97* This job media sheets attribute's value and <CODE>object</CODE>'s98* value are equal.99* </OL>100*101* @param object Object to compare to.102*103* @return True if <CODE>object</CODE> is equivalent to this job media104* sheets attribute, false otherwise.105*/106public boolean equals(Object object) {107return super.equals(object) && object instanceof JobMediaSheets;108}109110/**111* Get the printing attribute class which is to be used as the "category"112* for this printing attribute value.113* <P>114* For class JobMediaSheets and any vendor-defined subclasses, the category115* is class JobMediaSheets itself.116*117* @return Printing attribute class (category), an instance of class118* {@link java.lang.Class java.lang.Class}.119*/120public final Class<? extends Attribute> getCategory() {121return JobMediaSheets.class;122}123124/**125* Get the name of the category of which this attribute value is an126* instance.127* <P>128* For class JobMediaSheets and any vendor-defined subclasses, the129* category name is <CODE>"job-media-sheets"</CODE>.130*131* @return Attribute category name.132*/133public final String getName() {134return "job-media-sheets";135}136137}138139140