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