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