jdk/src/share/classes/javax/print/attribute/standard/Copies.java
author darcy
Fri, 10 Jan 2014 09:24:47 -0800
changeset 22260 c9185e010e03
parent 5506 202f599c92aa
permissions -rw-r--r--
8031082: Fix non-missing doclint problems in client libraries Reviewed-by: serb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
22260
c9185e010e03 8031082: Fix non-missing doclint problems in client libraries
darcy
parents: 5506
diff changeset
     2
 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
package javax.print.attribute.standard;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import javax.print.attribute.Attribute;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import javax.print.attribute.IntegerSyntax;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import javax.print.attribute.PrintRequestAttribute;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import javax.print.attribute.PrintJobAttribute;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * Class Copies is an integer valued printing attribute class that specifies the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * number of copies to be printed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * On many devices the supported number of collated copies will be limited by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * the number of physical output bins on the device, and may be different from
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * the number of uncollated copies which can be supported.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * The effect of a Copies attribute with a value of <I>n</I> on a multidoc print
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * job (a job with multiple documents) depends on the (perhaps defaulted) value
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * of the {@link MultipleDocumentHandling MultipleDocumentHandling} attribute:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * <UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * <LI>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * SINGLE_DOCUMENT -- The result will be <I>n</I> copies of a single output
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * document comprising all the input docs.
22260
c9185e010e03 8031082: Fix non-missing doclint problems in client libraries
darcy
parents: 5506
diff changeset
    47
 *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * <LI>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * SINGLE_DOCUMENT_NEW_SHEET -- The result will be <I>n</I> copies of a single
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * output document comprising all the input docs, and the first impression of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * each input doc will always start on a new media sheet.
22260
c9185e010e03 8031082: Fix non-missing doclint problems in client libraries
darcy
parents: 5506
diff changeset
    52
 *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * <LI>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The result will be <I>n</I> copies of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * the first input document, followed by <I>n</I> copies of the second input
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * document, . . . followed by <I>n</I> copies of the last input document.
22260
c9185e010e03 8031082: Fix non-missing doclint problems in client libraries
darcy
parents: 5506
diff changeset
    57
 *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * <LI>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The result will be the first input
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * document, the second input document, . . . the last input document, the group
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * of documents being repeated <I>n</I> times.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * </UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * category name returned by <CODE>getName()</CODE> gives the IPP attribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * @author  David Mendenhall
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * @author  Alan Kamihensky
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
public final class Copies extends IntegerSyntax
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        implements PrintRequestAttribute, PrintJobAttribute {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    private static final long serialVersionUID = -6426631521680023833L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * Construct a new copies attribute with the given integer value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * @param  value  Integer value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * @exception  IllegalArgumentException
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     *  (Unchecked exception) Thrown if <CODE>value</CODE> is less than 1.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    public Copies(int value) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        super (value, 1, Integer.MAX_VALUE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * Returns whether this copies attribute is equivalent to the passed in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * object. To be equivalent, all of the following conditions must be true:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * <OL TYPE=1>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * <LI>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * <CODE>object</CODE> is not null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * <LI>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * <CODE>object</CODE> is an instance of class Copies.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * <LI>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * This copies attribute's value and <CODE>object</CODE>'s value are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * equal.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * </OL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * @param  object  Object to compare to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * @return  True if <CODE>object</CODE> is equivalent to this copies
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     *          attribute, false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    public boolean equals(Object object) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        return super.equals (object) && object instanceof Copies;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * Get the printing attribute class which is to be used as the "category"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * for this printing attribute value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * For class Copies, the category is class Copies itself.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * @return  Printing attribute class (category), an instance of class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     *          {@link java.lang.Class java.lang.Class}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    public final Class<? extends Attribute> getCategory() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        return Copies.class;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * Get the name of the category of which this attribute value is an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * instance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * For class Copies, the category name is <CODE>"copies"</CODE>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * @return  Attribute category name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    public final String getName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        return "copies";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
}