1. /*
  2. * @(#)QueuedJobCount.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.PrintServiceAttribute;
  10. /**
  11. * Class QueuedJobCount is an integer valued printing attribute that indicates
  12. * the number of jobs in the printer whose {@link JobState JobState} is either
  13. * PENDING, PENDING_HELD, PROCESSING, or PROCESSING_STOPPED.
  14. * <P>
  15. * <B>IPP Compatibility:</B> The integer value gives the IPP integer value.
  16. * The category name returned by <CODE>getName()</CODE> gives the IPP
  17. * attribute name.
  18. * <P>
  19. *
  20. * @author Alan Kaminsky
  21. */
  22. public final class QueuedJobCount extends IntegerSyntax
  23. implements PrintServiceAttribute {
  24. /**
  25. * Construct a new queued job count attribute with the given integer
  26. * value.
  27. *
  28. * @param value Integer value.
  29. *
  30. * @exception IllegalArgumentException
  31. * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0.
  32. */
  33. public QueuedJobCount(int value) {
  34. super (value, 0, Integer.MAX_VALUE);
  35. }
  36. /**
  37. * Returns whether this queued job count attribute is equivalent to the
  38. * passed in object. To be equivalent, all of the following conditions
  39. * mus be true:
  40. * <OL TYPE=1>
  41. * <LI>
  42. * <CODE>object</CODE> is not null.
  43. * <LI>
  44. * <CODE>object</CODE> is an instance of class QueuedJobCount.
  45. * <LI>
  46. * This queued job count attribute's value and <CODE>object</CODE>'s
  47. * value are equal.
  48. * </OL>
  49. *
  50. * @param object Object to compare to.
  51. *
  52. * @return True if <CODE>object</CODE> is equivalent to this queued job
  53. * count attribute, false otherwise.
  54. */
  55. public boolean equals(Object object) {
  56. return (super.equals (object) &&
  57. object instanceof QueuedJobCount);
  58. }
  59. /**
  60. * Get the printing attribute class which is to be used as the "category"
  61. * for this printing attribute value.
  62. * <P>
  63. * For class QueuedJobCount, the category is class QueuedJobCount itself.
  64. *
  65. * @return Printing attribute class (category), an instance of class
  66. * {@link java.lang.Class java.lang.Class}.
  67. */
  68. public final Class getCategory() {
  69. return QueuedJobCount.class;
  70. }
  71. /**
  72. * Get the name of the category of which this attribute value is an
  73. * instance.
  74. * <P>
  75. * For class QueuedJobCount, the
  76. * category name is <CODE>"queued-job-count"</CODE>.
  77. *
  78. * @return Attribute category name.
  79. */
  80. public final String getName() {
  81. return "queued-job-count";
  82. }
  83. }