Path: blob/master/src/java.desktop/share/classes/javax/print/attribute/standard/Copies.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 Copies} is an integer valued printing attribute class that36* specifies the number of copies to be printed.37* <p>38* On many devices the supported number of collated copies will be limited by39* the number of physical output bins on the device, and may be different from40* the number of uncollated copies which can be supported.41* <p>42* The effect of a {@code Copies} attribute with a value of <i>n</i> on a43* multidoc print job (a job with multiple documents) depends on the (perhaps44* defaulted) value of the45* {@link MultipleDocumentHandling MultipleDocumentHandling} attribute:46* <ul>47* <li>{@code SINGLE_DOCUMENT} -- The result will be <i>n</i> copies of a48* single output document comprising all the input docs.49* <li>{@code SINGLE_DOCUMENT_NEW_SHEET} -- The result will be <i>n</i> copies50* of a single output document comprising all the input docs, and the first51* impression of each input doc will always start on a new media sheet.52* <li>{@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- The result will be53* <i>n</i> copies of the first input document, followed by <i>n</i> copies of54* the second input document, . . . followed by <i>n</i> copies of the last55* input document.56* <li>{@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- The result will be the57* first input document, the second input document, . . . the last input58* document, the group of documents being repeated <i>n</i> times.59* </ul>60* <p>61* <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The62* category name returned by {@code getName()} gives the IPP attribute name.63*64* @author David Mendenhall65* @author Alan Kamihensky66*/67public final class Copies extends IntegerSyntax68implements PrintRequestAttribute, PrintJobAttribute {6970/**71* Use serialVersionUID from JDK 1.4 for interoperability.72*/73@Serial74private static final long serialVersionUID = -6426631521680023833L;7576/**77* Construct a new copies attribute with the given integer value.78*79* @param value Integer value80* @throws IllegalArgumentException if {@code value < 1}81*/82public Copies(int value) {83super (value, 1, Integer.MAX_VALUE);84}8586/**87* Returns whether this copies attribute is equivalent to the passed in88* object. To be equivalent, all of the following conditions must be true:89* <ol type=1>90* <li>{@code object} is not {@code null}.91* <li>{@code object} is an instance of class {@code Copies}.92* <li>This copies attribute's value and {@code object}'s value are equal.93* </ol>94*95* @param object {@code Object} to compare to96* @return {@code true} if {@code object} is equivalent to this copies97* attribute, {@code false} otherwise98*/99public boolean equals(Object object) {100return super.equals (object) && object instanceof Copies;101}102103/**104* Get the printing attribute class which is to be used as the "category"105* for this printing attribute value.106* <p>107* For class {@code Copies}, the category is class {@code Copies} itself.108*109* @return printing attribute class (category), an instance of class110* {@link Class java.lang.Class}111*/112public final Class<? extends Attribute> getCategory() {113return Copies.class;114}115116/**117* Get the name of the category of which this attribute value is an118* instance.119* <p>120* For class {@code Copies}, the category name is {@code "copies"}.121*122* @return attribute category name123*/124public final String getName() {125return "copies";126}127}128129130