1. /*
  2. * @(#)JobImpressions.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 JobImpressions is an integer valued printing attribute class that
  14. * specifies the total size in number of impressions of the document(s) being
  15. * submitted. An "impression" is the image (possibly many print-stream pages in
  16. * different configurations) imposed onto a single media page.
  17. * <P>
  18. * The JobImpressions attribute describes the size of the job. This attribute is
  19. * not intended to be a counter; it is intended to be useful routing and
  20. * scheduling information if known. The printer may try to compute the
  21. * JobImpressions attribute's value if it is not supplied in the Print Request.
  22. * Even if the client does supply a value for the JobImpressions attribute in
  23. * the Print Request, the printer may choose to change the value if the printer
  24. * is able to compute a value which is more accurate than the client supplied
  25. * value. The printer may be able to determine the correct value for the
  26. * JobImpressions attribute either right at job submission time or at any later
  27. * point in time.
  28. * <P>
  29. * As with {@link JobKOctets JobKOctets}, the JobImpressions value must not
  30. * include the multiplicative factors contributed by the number of copies
  31. * specified by the {@link Copies Copies} attribute, independent of whether the
  32. * device can process multiple copies without making multiple passes over the
  33. * job or document data and independent of whether the output is collated or
  34. * not. Thus the value is independent of the implementation and reflects the
  35. * size of the document(s) measured in impressions independent of the number of
  36. * copies.
  37. * <P>
  38. * As with {@link JobKOctets JobKOctets}, the JobImpressions value must also not
  39. * include the multiplicative factor due to a copies instruction embedded in the
  40. * document data. If the document data actually includes replications of the
  41. * document data, this value will include such replication. In other words, this
  42. * value is always the number of impressions in the source document data, rather
  43. * than a measure of the number of impressions to be produced by the job.
  44. * <P>
  45. * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
  46. * category name returned by <CODE>getName()</CODE> gives the IPP attribute
  47. * name.
  48. * <P>
  49. *
  50. * @see JobImpressionsSupported
  51. * @see JobImpressionsCompleted
  52. * @see JobKOctets
  53. * @see JobMediaSheets
  54. *
  55. * @author Alan Kaminsky
  56. */
  57. public final class JobImpressions extends IntegerSyntax
  58. implements PrintRequestAttribute, PrintJobAttribute {
  59. private static final long serialVersionUID = 8225537206784322464L;
  60. /**
  61. * Construct a new job impressions attribute with the given integer value.
  62. *
  63. * @param value Integer value.
  64. *
  65. * @exception IllegalArgumentException
  66. * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0.
  67. */
  68. public JobImpressions(int value) {
  69. super(value, 0, Integer.MAX_VALUE);
  70. }
  71. /**
  72. * Returns whether this job impressions attribute is equivalent to the
  73. * passed in object. To be equivalent, all of the following conditions must
  74. * be true:
  75. * <OL TYPE=1>
  76. * <LI>
  77. * <CODE>object</CODE> is not null.
  78. * <LI>
  79. * <CODE>object</CODE> is an instance of class JobImpressions.
  80. * <LI>
  81. * This job impressions attribute's value and <CODE>object</CODE>'s value
  82. * are equal.
  83. * </OL>
  84. *
  85. * @param object Object to compare to.
  86. *
  87. * @return True if <CODE>object</CODE> is equivalent to this job
  88. * impressions attribute, false otherwise.
  89. */
  90. public boolean equals(Object object) {
  91. return super.equals (object) && object instanceof JobImpressions;
  92. }
  93. /**
  94. * Get the printing attribute class which is to be used as the "category"
  95. * for this printing attribute value.
  96. * <P>
  97. * For class JobImpressions, the category is class JobImpressions itself.
  98. *
  99. * @return Printing attribute class (category), an instance of class
  100. * {@link java.lang.Class java.lang.Class}.
  101. */
  102. public final Class<? extends Attribute> getCategory() {
  103. return JobImpressions.class;
  104. }
  105. /**
  106. * Get the name of the category of which this attribute value is an
  107. * instance.
  108. * <P>
  109. * For class JobImpressions, the category name is
  110. * <CODE>"job-impressions"</CODE>.
  111. *
  112. * @return Attribute category name.
  113. */
  114. public final String getName() {
  115. return "job-impressions";
  116. }
  117. }