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