1. /*
  2. * @(#)JobMediaSheetsSupported.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.SetOfIntegerSyntax;
  10. import javax.print.attribute.SupportedValuesAttribute;
  11. /**
  12. * Class JobMediaSheetsSupported is a printing attribute class, a set of
  13. * integers, that gives the supported values for a {@link JobMediaSheets
  14. * JobMediaSheets} attribute. It is restricted to a single contiguous range of
  15. * integers; multiple non-overlapping ranges are not allowed. This gives the
  16. * lower and upper bounds of the total sizes of print jobs in number of media
  17. * sheets that the printer will accept.
  18. * <P>
  19. * <B>IPP Compatibility:</B> The JobMediaSheetsSupported attribute's canonical
  20. * array form gives the lower and upper bound for the range of values to be
  21. * included in an IPP "job-media-sheets-supported" attribute. See class {@link
  22. * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an
  23. * explanation of canonical array form. The category name returned by
  24. * <CODE>getName()</CODE> gives the IPP attribute name.
  25. * <P>
  26. *
  27. * @author Alan Kaminsky
  28. */
  29. public final class JobMediaSheetsSupported extends SetOfIntegerSyntax
  30. implements SupportedValuesAttribute {
  31. private static final long serialVersionUID = 2953685470388672940L;
  32. /**
  33. * Construct a new job media sheets supported attribute containing a single
  34. * range of integers. That is, only those values of JobMediaSheets in the
  35. * one range are supported.
  36. *
  37. * @param lowerBound Lower bound of the range.
  38. * @param upperBound Upper bound of the range.
  39. *
  40. * @exception IllegalArgumentException
  41. * (Unchecked exception) Thrown if a null range is specified or if a
  42. * non-null range is specified with <CODE>lowerBound</CODE> less than
  43. * 0.
  44. */
  45. public JobMediaSheetsSupported(int lowerBound, int upperBound) {
  46. super (lowerBound, upperBound);
  47. if (lowerBound > upperBound) {
  48. throw new IllegalArgumentException("Null range specified");
  49. } else if (lowerBound < 0) {
  50. throw new IllegalArgumentException
  51. ("Job K octets value < 0 specified");
  52. }
  53. }
  54. /**
  55. * Returns whether this job media sheets supported attribute is equivalent
  56. * to the passed in object. To be equivalent, all of the following
  57. * conditions must be true:
  58. * <OL TYPE=1>
  59. * <LI>
  60. * <CODE>object</CODE> is not null.
  61. * <LI>
  62. * <CODE>object</CODE> is an instance of class JobMediaSheetsSupported.
  63. * <LI>
  64. * This job media sheets supported attribute's members and
  65. * <CODE>object</CODE>'s members are the same.
  66. * </OL>
  67. *
  68. * @param object Object to compare to.
  69. *
  70. * @return True if <CODE>object</CODE> is equivalent to this job media
  71. * sheets supported attribute, false otherwise.
  72. */
  73. public boolean equals(Object object) {
  74. return (super.equals (object) &&
  75. object instanceof JobMediaSheetsSupported);
  76. }
  77. /**
  78. * Get the printing attribute class which is to be used as the "category"
  79. * for this printing attribute value.
  80. * <P>
  81. * For class JobMediaSheetsSupported, the
  82. * category is class JobMediaSheetsSupported itself.
  83. *
  84. * @return Printing attribute class (category), an instance of class
  85. * {@link java.lang.Class java.lang.Class}.
  86. */
  87. public final Class<? extends Attribute> getCategory() {
  88. return JobMediaSheetsSupported.class;
  89. }
  90. /**
  91. * Get the name of the category of which this attribute value is an
  92. * instance.
  93. * <P>
  94. * For class JobMediaSheetsSupported, the
  95. * category name is <CODE>"job-media-sheets-supported"</CODE>.
  96. *
  97. * @return Attribute category name.
  98. */
  99. public final String getName() {
  100. return "job-media-sheets-supported";
  101. }
  102. }