1. /*
  2. * @(#)JobKOctetsSupported.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 JobKOctetsSupported is a printing attribute class, a set of integers,
  12. * that gives the supported values for a {@link JobKOctets JobKOctets}
  13. * attribute. It is restricted to a single contiguous range of integers;
  14. * multiple non-overlapping ranges are not allowed. This gives the lower and
  15. * upper bounds of the total sizes of print jobs in units of K octets (1024
  16. * octets) that the printer will accept.
  17. * <P>
  18. * <B>IPP Compatibility:</B> The JobKOctetsSupported attribute's canonical array
  19. * form gives the lower and upper bound for the range of values to be included
  20. * in an IPP "job-k-octets-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 JobKOctetsSupported extends SetOfIntegerSyntax
  29. implements SupportedValuesAttribute {
  30. /**
  31. * Construct a new job K octets supported attribute containing a single
  32. * range of integers. That is, only those values of JobKOctets in the one
  33. * 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 JobKOctetsSupported(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 K octets supported attribute is equivalent to
  54. * the passed in object. To be equivalent, all of the following conditions
  55. * 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 JobKOctetsSupported.
  61. * <LI>
  62. * This job K octets 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 K
  69. * octets supported attribute, false otherwise.
  70. */
  71. public boolean equals(Object object) {
  72. return (super.equals (object) &&
  73. object instanceof JobKOctetsSupported);
  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 JobKOctetsSupported, the category is class
  80. * JobKOctetsSupported 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 JobKOctetsSupported.class;
  87. }
  88. /**
  89. * Get the name of the category of which this attribute value is an
  90. * instance.
  91. * <P>
  92. * For class JobKOctetsSupported, the category name is
  93. * <CODE>"job-k-octets-supported"</CODE>.
  94. *
  95. * @return Attribute category name.
  96. */
  97. public final String getName() {
  98. return "job-k-octets-supported";
  99. }
  100. }