Path: blob/master/src/java.desktop/share/classes/javax/print/attribute/standard/JobImpressions.java
41171 views
/*1* Copyright (c) 2000, 2021, 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*/2425package javax.print.attribute.standard;2627import java.io.Serial;2829import javax.print.attribute.Attribute;30import javax.print.attribute.IntegerSyntax;31import javax.print.attribute.PrintJobAttribute;32import javax.print.attribute.PrintRequestAttribute;3334/**35* Class {@code JobImpressions} is an integer valued printing attribute class36* that specifies the total size in number of impressions of the document(s)37* being submitted. An "impression" is the image (possibly many print-stream38* pages in different configurations) imposed onto a single media page.39* <p>40* The {@code JobImpressions} attribute describes the size of the job. This41* attribute is not intended to be a counter; it is intended to be useful42* routing and scheduling information if known. The printer may try to compute43* the {@code JobImpressions} attribute's value if it is not supplied in the44* Print Request. Even if the client does supply a value for the45* {@code JobImpressions} attribute in the Print Request, the printer may choose46* to change the value if the printer is able to compute a value which is more47* accurate than the client supplied value. The printer may be able to determine48* the correct value for the {@code JobImpressions} attribute either right at49* job submission time or at any later point in time.50* <p>51* As with {@link JobKOctets JobKOctets}, the {@code JobImpressions} value must52* not include the multiplicative factors contributed by the number of copies53* specified by the {@link Copies Copies} attribute, independent of whether the54* device can process multiple copies without making multiple passes over the55* job or document data and independent of whether the output is collated or56* not. Thus the value is independent of the implementation and reflects the57* size of the document(s) measured in impressions independent of the number of58* copies.59* <p>60* As with {@link JobKOctets JobKOctets}, the {@code JobImpressions} value must61* also not include the multiplicative factor due to a copies instruction62* embedded in the document data. If the document data actually includes63* replications of the document data, this value will include such replication.64* In other words, this value is always the number of impressions in the source65* document data, rather than a measure of the number of impressions to be66* produced by the job.67* <p>68* <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The69* category name returned by {@code getName()} gives the IPP attribute name.70*71* @author Alan Kaminsky72* @see JobImpressionsSupported73* @see JobImpressionsCompleted74* @see JobKOctets75* @see JobMediaSheets76*/77public final class JobImpressions extends IntegerSyntax78implements PrintRequestAttribute, PrintJobAttribute {7980/**81* Use serialVersionUID from JDK 1.4 for interoperability.82*/83@Serial84private static final long serialVersionUID = 8225537206784322464L;8586/**87* Construct a new job impressions attribute with the given integer value.88*89* @param value Integer value90* @throws IllegalArgumentException if {@code value} is negative91*92*/93public JobImpressions(int value) {94super(value, 0, Integer.MAX_VALUE);95}9697/**98* Returns whether this job impressions attribute is equivalent to the99* passed in object. To be equivalent, all of the following conditions must100* be true:101* <ol type=1>102* <li>{@code object} is not {@code null}.103* <li>{@code object} is an instance of class {@code JobImpressions}.104* <li>This job impressions attribute's value and {@code object}'s value105* are equal.106* </ol>107*108* @param object {@code Object} to compare to109* @return {@code true} if {@code object} is equivalent to this job110* impressions attribute, {@code false} otherwise111*/112public boolean equals(Object object) {113return super.equals (object) && object instanceof JobImpressions;114}115116/**117* Get the printing attribute class which is to be used as the "category"118* for this printing attribute value.119* <p>120* For class {@code JobImpressions}, the category is class121* {@code JobImpressions} itself.122*123* @return printing attribute class (category), an instance of class124* {@link Class java.lang.Class}125*/126public final Class<? extends Attribute> getCategory() {127return JobImpressions.class;128}129130/**131* Get the name of the category of which this attribute value is an132* instance.133* <p>134* For class {@code JobImpressions}, the category name is135* {@code "job-impressions"}.136*137* @return attribute category name138*/139public final String getName() {140return "job-impressions";141}142}143144145