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