1. /*
  2. * @(#)JobKOctetsProcessed.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.PrintJobAttribute;
  11. /**
  12. * Class JobKOctetsProcessed is an integer valued printing attribute class that
  13. * specifies the total number of print data octets processed so far in K octets,
  14. * i.e., in units of 1024 octets. The value must be rounded up, so that a job
  15. * between 1 and 1024 octets inclusive must be indicated as being 1K octets,
  16. * 1025 to 2048 inclusive must be 2K, etc. For a multidoc print job (a job with
  17. * multiple documents), the JobKOctetsProcessed value is computed by adding up
  18. * the individual documents' number of octets processed so far, then rounding up
  19. * to the next K octets value.
  20. * <P>
  21. * The JobKOctetsProcessed attribute describes the progress of the job. This
  22. * attribute is intended to be a counter. That is, the JobKOctetsProcessed value
  23. * for a job that has not started processing must be 0. When the job's {@link
  24. * JobState JobState} is PROCESSING or PROCESSING_STOPPED, the
  25. * JobKOctetsProcessed value is intended to increase as the job is processed; it
  26. * indicates the amount of the job that has been processed at the time the Print
  27. * Job's attribute set is queried or at the time a print job event is reported.
  28. * When the job enters the COMPLETED, CANCELED, or ABORTED states, the
  29. * JobKOctetsProcessed value is the final value for the job.
  30. * <P>
  31. * For implementations where multiple copies are produced by the interpreter
  32. * with only a single pass over the data, the final value of the
  33. * JobKOctetsProcessed attribute must be equal to the value of the {@link
  34. * JobKOctets JobKOctets} attribute. For implementations where multiple copies
  35. * are produced by the interpreter by processing the data for each copy, the
  36. * final value must be a multiple of the value of the {@link JobKOctets
  37. * JobKOctets} attribute.
  38. * <P>
  39. * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
  40. * category name returned by <CODE>getName()</CODE> gives the IPP attribute
  41. * name.
  42. * <P>
  43. *
  44. * @see JobKOctets
  45. * @see JobKOctetsSupported
  46. * @see JobImpressionsCompleted
  47. * @see JobMediaSheetsCompleted
  48. *
  49. * @author Alan Kaminsky
  50. */
  51. public final class JobKOctetsProcessed extends IntegerSyntax
  52. implements PrintJobAttribute {
  53. private static final long serialVersionUID = -6265238509657881806L;
  54. /**
  55. * Construct a new job K octets processed attribute with the given integer
  56. * value.
  57. *
  58. * @param value Integer value.
  59. *
  60. * @exception IllegalArgumentException
  61. * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0.
  62. */
  63. public JobKOctetsProcessed(int value) {
  64. super (value, 0, Integer.MAX_VALUE);
  65. }
  66. /**
  67. * Returns whether this job K octets processed attribute is equivalent to
  68. * the passed in object. To be equivalent, all of the following conditions
  69. * must be true:
  70. * <OL TYPE=1>
  71. * <LI>
  72. * <CODE>object</CODE> is not null.
  73. * <LI>
  74. * <CODE>object</CODE> is an instance of class JobKOctetsProcessed.
  75. * <LI>
  76. * This job K octets processed attribute's value and
  77. * <CODE>object</CODE>'s value are equal.
  78. * </OL>
  79. *
  80. * @param object Object to compare to.
  81. *
  82. * @return True if <CODE>object</CODE> is equivalent to this job K
  83. * octets processed attribute, false otherwise.
  84. */
  85. public boolean equals(Object object) {
  86. return(super.equals (object) &&
  87. object instanceof JobKOctetsProcessed);
  88. }
  89. /**
  90. * Get the printing attribute class which is to be used as the "category"
  91. * for this printing attribute value.
  92. * <P>
  93. * For class JobKOctetsProcessed, the category is class
  94. * JobKOctetsProcessed itself.
  95. *
  96. * @return Printing attribute class (category), an instance of class
  97. * {@link java.lang.Class java.lang.Class}.
  98. */
  99. public final Class<? extends Attribute> getCategory() {
  100. return JobKOctetsProcessed.class;
  101. }
  102. /**
  103. * Get the name of the category of which this attribute value is an
  104. * instance.
  105. * <P>
  106. * For class JobKOctetsProcessed, the category name is
  107. * <CODE>"job-k-octets-processed"</CODE>.
  108. *
  109. * @return Attribute category name.
  110. */
  111. public final String getName() {
  112. return "job-k-octets-processed";
  113. }
  114. }