1. /*
  2. * @(#)JobMediaSheets.java 1.6 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 JobMediaSheets is an integer valued printing attribute class that
  14. * specifies the total number of media sheets to be produced for this job.
  15. * <P>
  16. * The JobMediaSheets attribute describes the size of the job. This attribute is
  17. * not intended to be a counter; it is intended to be useful routing and
  18. * scheduling information if known. The printer may try to compute the
  19. * JobMediaSheets attribute's value if it is not supplied in the Print Request.
  20. * Even if the client does supply a value for the JobMediaSheets attribute in
  21. * the Print Request, the printer may choose to change the value if the printer
  22. * is able to compute a value which is more accurate than the client supplied
  23. * value. The printer may be able to determine the correct value for the
  24. * JobMediaSheets attribute either right at job submission time or at any later
  25. * point in time.
  26. * <P>
  27. * Unlike the {@link JobKOctets JobKOctets} and {@link JobImpressions
  28. * JobImpressions} attributes, the JobMediaSheets value must include the
  29. * multiplicative factors contributed by the number of copies specified by the
  30. * {@link Copies Copies} attribute and a "number of copies" instruction embedded
  31. * in the document data, if any. This difference allows the system administrator
  32. * to control the lower and upper bounds of both (1) the size of the document(s)
  33. * with {@link JobKOctetsSupported JobKOctetsSupported} and {@link
  34. * JobImpressionsSupported JobImpressionsSupported} and (2) the size of the job
  35. * with {@link JobMediaSheetsSupported JobMediaSheetsSupported}.
  36. * <P>
  37. * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
  38. * category name returned by <CODE>getName()</CODE> gives the IPP attribute
  39. * name.
  40. * <P>
  41. *
  42. * @see JobMediaSheetsSupported
  43. * @see JobMediaSheetsCompleted
  44. * @see JobKOctets
  45. * @see JobImpressions
  46. *
  47. * @author Alan Kaminsky
  48. */
  49. public class JobMediaSheets extends IntegerSyntax
  50. implements PrintRequestAttribute, PrintJobAttribute {
  51. private static final long serialVersionUID = 408871131531979741L;
  52. /**
  53. * Construct a new job media sheets attribute with the given integer
  54. * value.
  55. *
  56. * @param value Integer value.
  57. *
  58. * @exception IllegalArgumentException
  59. * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0.
  60. */
  61. public JobMediaSheets(int value) {
  62. super (value, 0, Integer.MAX_VALUE);
  63. }
  64. /**
  65. * Returns whether this job media sheets attribute is equivalent to the
  66. * passed in object. To be equivalent, all of the following conditions must
  67. * be true:
  68. * <OL TYPE=1>
  69. * <LI>
  70. * <CODE>object</CODE> is not null.
  71. * <LI>
  72. * <CODE>object</CODE> is an instance of class JobMediaSheets.
  73. * <LI>
  74. * This job media sheets attribute's value and <CODE>object</CODE>'s
  75. * value are equal.
  76. * </OL>
  77. *
  78. * @param object Object to compare to.
  79. *
  80. * @return True if <CODE>object</CODE> is equivalent to this job media
  81. * sheets attribute, false otherwise.
  82. */
  83. public boolean equals(Object object) {
  84. return super.equals(object) && object instanceof JobMediaSheets;
  85. }
  86. /**
  87. * Get the printing attribute class which is to be used as the "category"
  88. * for this printing attribute value.
  89. * <P>
  90. * For class JobMediaSheets and any vendor-defined subclasses, the category
  91. * is class JobMediaSheets 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 JobMediaSheets.class;
  98. }
  99. /**
  100. * Get the name of the category of which this attribute value is an
  101. * instance.
  102. * <P>
  103. * For class JobMediaSheets and any vendor-defined subclasses, the
  104. * category name is <CODE>"job-media-sheets"</CODE>.
  105. *
  106. * @return Attribute category name.
  107. */
  108. public final String getName() {
  109. return "job-media-sheets";
  110. }
  111. }