1. /*
  2. * @(#)PagesPerMinute.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 PagesPerMinute is an integer valued printing attribute that indicates
  13. * the nominal number of pages per minute to the nearest whole number which may
  14. * be generated by this printer (e.g., simplex, black-and-white). This attribute
  15. * is informative, not a service guarantee. Generally, it is the value used in
  16. * the marketing literature to describe the device. A value of 0 indicates a
  17. * device that takes more than two minutes to process a page.
  18. * <P>
  19. * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
  20. * category name returned by <CODE>getName()</CODE> gives the IPP attribute
  21. * name.
  22. * <P>
  23. *
  24. * @author Alan Kaminsky
  25. */
  26. public final class PagesPerMinute extends IntegerSyntax
  27. implements PrintServiceAttribute {
  28. private static final long serialVersionUID = -6366403993072862015L;
  29. /**
  30. * Construct a new pages per minute attribute with the given integer
  31. * value.
  32. *
  33. * @param value Integer value.
  34. *
  35. * @exception IllegalArgumentException
  36. * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0.
  37. */
  38. public PagesPerMinute(int value) {
  39. super(value, 0, Integer.MAX_VALUE);
  40. }
  41. /**
  42. * Returns whether this pages per minute attribute is equivalent to the
  43. * passed in object. To be equivalent, all of the following conditions
  44. * must be true:
  45. * <OL TYPE=1>
  46. * <LI>
  47. * <CODE>object</CODE> is not null.
  48. * <LI>
  49. * <CODE>object</CODE> is an instance of class PagesPerMinute.
  50. * <LI>
  51. * This pages per minute attribute's value and <CODE>object</CODE>'s
  52. * value are equal.
  53. * </OL>
  54. *
  55. * @param object Object to compare to.
  56. *
  57. * @return True if <CODE>object</CODE> is equivalent to this pages per
  58. * minute attribute, false otherwise.
  59. */
  60. public boolean equals(Object object) {
  61. return (super.equals (object) &&
  62. object instanceof PagesPerMinute);
  63. }
  64. /**
  65. * Get the printing attribute class which is to be used as the "category"
  66. * for this printing attribute value.
  67. * <P>
  68. * For class PagesPerMinute, the category is class PagesPerMinute itself.
  69. *
  70. * @return Printing attribute class (category), an instance of class
  71. * {@link java.lang.Class java.lang.Class}.
  72. */
  73. public final Class<? extends Attribute> getCategory() {
  74. return PagesPerMinute.class;
  75. }
  76. /**
  77. * Get the name of the category of which this attribute value is an
  78. * instance.
  79. * <P>
  80. * For class PagesPerMinute, the
  81. * category name is <CODE>"pages-per-minute"</CODE>.
  82. *
  83. * @return Attribute category name.
  84. */
  85. public final String getName() {
  86. return "pages-per-minute";
  87. }
  88. }