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