1. /*
  2. * @(#)Copies.java 1.7 04/05/05
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.print.attribute.standard;
  8. import javax.print.attribute.Attribute;
  9. import javax.print.attribute.IntegerSyntax;
  10. import javax.print.attribute.PrintRequestAttribute;
  11. import javax.print.attribute.PrintJobAttribute;
  12. /**
  13. * Class Copies is an integer valued printing attribute class that specifies the
  14. * number of copies to be printed.
  15. * <P>
  16. * On many devices the supported number of collated copies will be limited by
  17. * the number of physical output bins on the device, and may be different from
  18. * the number of uncollated copies which can be supported.
  19. * <P>
  20. * The effect of a Copies attribute with a value of <I>n</I> on a multidoc print
  21. * job (a job with multiple documents) depends on the (perhaps defaulted) value
  22. * of the {@link MultipleDocumentHandling MultipleDocumentHandling} attribute:
  23. * <UL>
  24. * <LI>
  25. * SINGLE_DOCUMENT -- The result will be <I>n</I> copies of a single output
  26. * document comprising all the input docs.
  27. * <P>
  28. * <LI>
  29. * SINGLE_DOCUMENT_NEW_SHEET -- The result will be <I>n</I> copies of a single
  30. * output document comprising all the input docs, and the first impression of
  31. * each input doc will always start on a new media sheet.
  32. * <P>
  33. * <LI>
  34. * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The result will be <I>n</I> copies of
  35. * the first input document, followed by <I>n</I> copies of the second input
  36. * document, . . . followed by <I>n</I> copies of the last input document.
  37. * <P>
  38. * <LI>
  39. * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The result will be the first input
  40. * document, the second input document, . . . the last input document, the group
  41. * of documents being repeated <I>n</I> times.
  42. * </UL>
  43. * <P>
  44. * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
  45. * category name returned by <CODE>getName()</CODE> gives the IPP attribute
  46. * name.
  47. * <P>
  48. *
  49. * @author David Mendenhall
  50. * @author Alan Kamihensky
  51. */
  52. public final class Copies extends IntegerSyntax
  53. implements PrintRequestAttribute, PrintJobAttribute {
  54. private static final long serialVersionUID = -6426631521680023833L;
  55. /**
  56. * Construct a new copies attribute with the given integer value.
  57. *
  58. * @param value Integer value.
  59. *
  60. * @exception IllegalArgumentException
  61. * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 1.
  62. */
  63. public Copies(int value) {
  64. super (value, 1, Integer.MAX_VALUE);
  65. }
  66. /**
  67. * Returns whether this copies attribute is equivalent to the passed in
  68. * object. To be equivalent, all of the following conditions must be true:
  69. * <OL TYPE=1>
  70. * <LI>
  71. * <CODE>object</CODE> is not null.
  72. * <LI>
  73. * <CODE>object</CODE> is an instance of class Copies.
  74. * <LI>
  75. * This copies attribute's value and <CODE>object</CODE>'s value are
  76. * equal.
  77. * </OL>
  78. *
  79. * @param object Object to compare to.
  80. *
  81. * @return True if <CODE>object</CODE> is equivalent to this copies
  82. * attribute, false otherwise.
  83. */
  84. public boolean equals(Object object) {
  85. return super.equals (object) && object instanceof Copies;
  86. }
  87. /**
  88. * Get the printing attribute class which is to be used as the "category"
  89. * for this printing attribute value.
  90. * <P>
  91. * For class Copies, the category is class Copies itself.
  92. *
  93. * @return Printing attribute class (category), an instance of class
  94. * {@link java.lang.Class java.lang.Class}.
  95. */
  96. public final Class<? extends Attribute> getCategory() {
  97. return Copies.class;
  98. }
  99. /**
  100. * Get the name of the category of which this attribute value is an
  101. * instance.
  102. * <P>
  103. * For class Copies, the category name is <CODE>"copies"</CODE>.
  104. *
  105. * @return Attribute category name.
  106. */
  107. public final String getName() {
  108. return "copies";
  109. }
  110. }