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