1. /*
  2. * @(#)JobPriority.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.PrintRequestAttribute;
  10. import javax.print.attribute.PrintJobAttribute;
  11. /**
  12. * Class JobPriority is an integer valued printing attribute class that
  13. * specifies a print job's priority.
  14. * <P>
  15. * If a JobPriority attribute is specified for a Print Job, it specifies a
  16. * priority for scheduling the job. A higher value specifies a higher priority.
  17. * The value 1 indicates the lowest possible priority. The value 100 indicates
  18. * the highest possible priority. Among those jobs that are ready to print, a
  19. * printer must print all jobs with a priority value of <I>n</I> before printing
  20. * those with a priority value of <I>n</I>-1 for all <I>n.</I>
  21. * <P>
  22. * If the client does not specify a JobPriority attribute for a Print Job and
  23. * the printer does support the JobPriority attribute, the printer must use an
  24. * implementation-defined default JobPriority value.
  25. * <P>
  26. * The client can always specify any job priority value from 1 to 100 for a job.
  27. * However, a Print Service instance may support fewer than 100 different
  28. * job priority levels. If this is the case, the Print Service instance
  29. * automatically maps the client-specified job priority value to one of the
  30. * supported job priority levels, dividing the 100 job priority values equally
  31. * among the available job priority levels.
  32. * <P>
  33. * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
  34. * category name returned by <CODE>getName()</CODE> gives the IPP attribute
  35. * name.
  36. * <P>
  37. *
  38. * @author Alan Kaminsky
  39. */
  40. public final class JobPriority extends IntegerSyntax
  41. implements PrintRequestAttribute, PrintJobAttribute {
  42. /**
  43. * Construct a new job priority attribute with the given integer value.
  44. *
  45. * @param value Integer value.
  46. *
  47. * @exception IllegalArgumentException
  48. * (Unchecked exception) Thrown if <CODE>value</CODE> is less than 1
  49. * or greater than 100.
  50. */
  51. public JobPriority(int value) {
  52. super (value, 1, 100);
  53. }
  54. /**
  55. * Returns whether this job priority attribute is equivalent to the passed
  56. * in object. To be equivalent, all of the following conditions must be
  57. * 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 JobPriority.
  63. * <LI>
  64. * This job priority attribute's value and <CODE>object</CODE>'s value
  65. * are equal.
  66. * </OL>
  67. *
  68. * @param object Object to compare to.
  69. *
  70. * @return True if <CODE>object</CODE> is equivalent to this job
  71. * priority attribute, false otherwise.
  72. */
  73. public boolean equals(Object object) {
  74. return (super.equals (object) && object instanceof JobPriority);
  75. }
  76. /**
  77. * Get the printing attribute class which is to be used as the "category"
  78. * for this printing attribute value.
  79. * <P>
  80. * For class JobPriority, the category is class JobPriority 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 JobPriority.class;
  87. }
  88. /**
  89. * Get the name of the category of which this attribute value is an
  90. * instance.
  91. * <P>
  92. * For class JobPriority, the category name is <CODE>"job-priority"</CODE>.
  93. *
  94. * @return Attribute category name.
  95. */
  96. public final String getName() {
  97. return "job-priority";
  98. }
  99. }