Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/print/attribute/standard/Copies.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 Copies is an integer valued printing attribute class that specifies the33* number of copies to be printed.34* <P>35* On many devices the supported number of collated copies will be limited by36* the number of physical output bins on the device, and may be different from37* the number of uncollated copies which can be supported.38* <P>39* The effect of a Copies attribute with a value of <I>n</I> on a multidoc print40* job (a job with multiple documents) depends on the (perhaps defaulted) value41* of the {@link MultipleDocumentHandling MultipleDocumentHandling} attribute:42* <UL>43* <LI>44* SINGLE_DOCUMENT -- The result will be <I>n</I> copies of a single output45* document comprising all the input docs.46* <P>47* <LI>48* SINGLE_DOCUMENT_NEW_SHEET -- The result will be <I>n</I> copies of a single49* output document comprising all the input docs, and the first impression of50* each input doc will always start on a new media sheet.51* <P>52* <LI>53* SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The result will be <I>n</I> copies of54* the first input document, followed by <I>n</I> copies of the second input55* document, . . . followed by <I>n</I> copies of the last input document.56* <P>57* <LI>58* SEPARATE_DOCUMENTS_COLLATED_COPIES -- The result will be the first input59* document, the second input document, . . . the last input document, the group60* of documents being repeated <I>n</I> times.61* </UL>62* <P>63* <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The64* category name returned by <CODE>getName()</CODE> gives the IPP attribute65* name.66* <P>67*68* @author David Mendenhall69* @author Alan Kamihensky70*/71public final class Copies extends IntegerSyntax72implements PrintRequestAttribute, PrintJobAttribute {7374private static final long serialVersionUID = -6426631521680023833L;7576/**77* Construct a new copies attribute with the given integer value.78*79* @param value Integer value.80*81* @exception IllegalArgumentException82* (Unchecked exception) Thrown if <CODE>value</CODE> is less than 1.83*/84public Copies(int value) {85super (value, 1, Integer.MAX_VALUE);86}8788/**89* Returns whether this copies attribute is equivalent to the passed in90* object. To be equivalent, all of the following conditions must 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 Copies.96* <LI>97* This copies attribute's value and <CODE>object</CODE>'s value are98* equal.99* </OL>100*101* @param object Object to compare to.102*103* @return True if <CODE>object</CODE> is equivalent to this copies104* attribute, false otherwise.105*/106public boolean equals(Object object) {107return super.equals (object) && object instanceof Copies;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 Copies, the category is class Copies itself.115*116* @return Printing attribute class (category), an instance of class117* {@link java.lang.Class java.lang.Class}.118*/119public final Class<? extends Attribute> getCategory() {120return Copies.class;121}122123/**124* Get the name of the category of which this attribute value is an125* instance.126* <P>127* For class Copies, the category name is <CODE>"copies"</CODE>.128*129* @return Attribute category name.130*/131public final String getName() {132return "copies";133}134135}136137138