1 /* 2 * Copyright (c) 2000, 2013, 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 package javax.print.attribute.standard; 26 27 import javax.print.attribute.Attribute; 28 import javax.print.attribute.IntegerSyntax; 29 import javax.print.attribute.PrintRequestAttribute; 30 import javax.print.attribute.PrintJobAttribute; 31 32 /** 33 * Class Copies is an integer valued printing attribute class that specifies the 34 * number of copies to be printed. 35 * <P> 36 * On many devices the supported number of collated copies will be limited by 37 * the number of physical output bins on the device, and may be different from 38 * the number of uncollated copies which can be supported. 39 * <P> 40 * The effect of a Copies attribute with a value of <I>n</I> on a multidoc print 41 * job (a job with multiple documents) depends on the (perhaps defaulted) value 42 * of the {@link MultipleDocumentHandling MultipleDocumentHandling} attribute: 43 * <UL> 44 * <LI> 45 * SINGLE_DOCUMENT -- The result will be <I>n</I> copies of a single output 46 * document comprising all the input docs. 47 * 48 * <LI> 49 * SINGLE_DOCUMENT_NEW_SHEET -- The result will be <I>n</I> copies of a single 50 * output document comprising all the input docs, and the first impression of 51 * each input doc will always start on a new media sheet. 52 * 53 * <LI> 54 * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The result will be <I>n</I> copies of 55 * the first input document, followed by <I>n</I> copies of the second input 56 * document, . . . followed by <I>n</I> copies of the last input document. 57 * 58 * <LI> 59 * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The result will be the first input 60 * document, the second input document, . . . the last input document, the group 61 * of documents being repeated <I>n</I> times. 62 * </UL> 63 * <P> 64 * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The 65 * category name returned by <CODE>getName()</CODE> gives the IPP attribute 66 * name. 67 * 68 * @author David Mendenhall 69 * @author Alan Kamihensky 70 */ 71 public final class Copies extends IntegerSyntax 72 implements PrintRequestAttribute, PrintJobAttribute { 73 74 private static final long serialVersionUID = -6426631521680023833L; 75 76 /** 77 * Construct a new copies attribute with the given integer value. 78 * 79 * @param value Integer value. 80 * 81 * @exception IllegalArgumentException 82 * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 1. 83 */ 84 public Copies(int value) { 85 super (value, 1, Integer.MAX_VALUE); 86 } 87 88 /** 89 * Returns whether this copies attribute is equivalent to the passed in 90 * 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 are 98 * equal. 99 * </OL> 100 * 101 * @param object Object to compare to. 102 * 103 * @return True if <CODE>object</CODE> is equivalent to this copies 104 * attribute, false otherwise. 105 */ 106 public boolean equals(Object object) { 107 return super.equals (object) && object instanceof Copies; 108 } 109 110 /** 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 class 117 * {@link java.lang.Class java.lang.Class}. 118 */ 119 public final Class<? extends Attribute> getCategory() { 120 return Copies.class; 121 } 122 123 /** 124 * Get the name of the category of which this attribute value is an 125 * instance. 126 * <P> 127 * For class Copies, the category name is <CODE>"copies"</CODE>. 128 * 129 * @return Attribute category name. 130 */ 131 public final String getName() { 132 return "copies"; 133 } 134 135 }