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