1 /* 2 * Copyright (c) 2000, 2017, 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 26 package javax.print.attribute.standard; 27 28 import javax.print.attribute.Attribute; 29 import javax.print.attribute.IntegerSyntax; 30 import javax.print.attribute.PrintJobAttribute; 31 import javax.print.attribute.PrintRequestAttribute; 32 33 /** 34 * Class {@code JobImpressions} is an integer valued printing attribute class 35 * that specifies the total size in number of impressions of the document(s) 36 * being submitted. An "impression" is the image (possibly many print-stream 37 * pages in different configurations) imposed onto a single media page. 38 * <p> 39 * The {@code JobImpressions} attribute describes the size of the job. This 40 * attribute is not intended to be a counter; it is intended to be useful 41 * routing and scheduling information if known. The printer may try to compute 42 * the {@code JobImpressions} attribute's value if it is not supplied in the 43 * Print Request. Even if the client does supply a value for the 44 * {@code JobImpressions} attribute in the Print Request, the printer may choose 45 * to change the value if the printer is able to compute a value which is more 46 * accurate than the client supplied value. The printer may be able to determine 47 * the correct value for the {@code JobImpressions} attribute either right at 48 * job submission time or at any later point in time. 49 * <p> 50 * As with {@link JobKOctets JobKOctets}, the {@code JobImpressions} value must 51 * not include the multiplicative factors contributed by the number of copies 52 * specified by the {@link Copies Copies} attribute, independent of whether the 53 * device can process multiple copies without making multiple passes over the 54 * job or document data and independent of whether the output is collated or 55 * not. Thus the value is independent of the implementation and reflects the 56 * size of the document(s) measured in impressions independent of the number of 57 * copies. 58 * <p> 59 * As with {@link JobKOctets JobKOctets}, the {@code JobImpressions} value must 60 * also not include the multiplicative factor due to a copies instruction 61 * embedded in the document data. If the document data actually includes 62 * replications of the document data, this value will include such replication. 63 * In other words, this value is always the number of impressions in the source 64 * document data, rather than a measure of the number of impressions to be 65 * produced by the job. 66 * <p> 67 * <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The 68 * category name returned by {@code getName()} gives the IPP attribute name. 69 * 70 * @author Alan Kaminsky 71 * @see JobImpressionsSupported 72 * @see JobImpressionsCompleted 73 * @see JobKOctets 74 * @see JobMediaSheets 75 */ 76 public final class JobImpressions extends IntegerSyntax 77 implements PrintRequestAttribute, PrintJobAttribute { 78 79 /** 80 * Use serialVersionUID from JDK 1.4 for interoperability. 81 */ 82 private static final long serialVersionUID = 8225537206784322464L; 83 84 /** 85 * Construct a new job impressions attribute with the given integer value. 86 * 87 * @param value Integer value 88 * @throws IllegalArgumentException if {@code value} is negative 89 * 90 */ 91 public JobImpressions(int value) { 92 super(value, 0, Integer.MAX_VALUE); 93 } 94 95 /** 96 * Returns whether this job impressions attribute is equivalent to the 97 * passed in object. To be equivalent, all of the following conditions must 98 * be true: 99 * <ol type=1> 100 * <li>{@code object} is not {@code null}. 101 * <li>{@code object} is an instance of class {@code JobImpressions}. 102 * <li>This job impressions attribute's value and {@code object}'s value 103 * are equal. 104 * </ol> 105 * 106 * @param object {@code Object} to compare to 107 * @return {@code true} if {@code object} is equivalent to this job 108 * impressions attribute, {@code false} otherwise 109 */ 110 public boolean equals(Object object) { 111 return super.equals (object) && object instanceof JobImpressions; 112 } 113 114 /** 115 * Get the printing attribute class which is to be used as the "category" 116 * for this printing attribute value. 117 * <p> 118 * For class {@code JobImpressions}, the category is class 119 * {@code JobImpressions} itself. 120 * 121 * @return printing attribute class (category), an instance of class 122 * {@link Class java.lang.Class} 123 */ 124 public final Class<? extends Attribute> getCategory() { 125 return JobImpressions.class; 126 } 127 128 /** 129 * Get the name of the category of which this attribute value is an 130 * instance. 131 * <p> 132 * For class {@code JobImpressions}, the category name is 133 * {@code "job-impressions"}. 134 * 135 * @return attribute category name 136 */ 137 public final String getName() { 138 return "job-impressions"; 139 } 140 }