1 /* 2 * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 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 JobKOctetsSupported is a printing attribute class, a set of integers, 33 * that gives the supported values for a {@link JobKOctets JobKOctets} 34 * attribute. It is restricted to a single contiguous range of integers; 35 * multiple non-overlapping ranges are not allowed. This gives the lower and 36 * upper bounds of the total sizes of print jobs in units of K octets (1024 37 * octets) that the printer will accept. 38 * <P> 39 * <B>IPP Compatibility:</B> The JobKOctetsSupported attribute's canonical array 40 * form gives the lower and upper bound for the range of values to be included 41 * in an IPP "job-k-octets-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 JobKOctetsSupported extends SetOfIntegerSyntax 49 implements SupportedValuesAttribute { 50 51 private static final long serialVersionUID = -2867871140549897443L; 52 53 /** 54 * Construct a new job K octets supported attribute containing a single 55 * range of integers. That is, only those values of JobKOctets in the one 56 * 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 JobKOctetsSupported(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 K octets supported attribute is equivalent to 78 * the passed in object. To be equivalent, all of the following conditions 79 * 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 JobKOctetsSupported. 85 * <LI> 86 * This job K octets 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 K 93 * octets supported attribute, false otherwise. 94 */ 95 public boolean equals(Object object) { 96 return (super.equals (object) && 97 object instanceof JobKOctetsSupported); 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 JobKOctetsSupported, the category is class 105 * JobKOctetsSupported 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 JobKOctetsSupported.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 JobKOctetsSupported, the category name is 119 * {@code "job-k-octets-supported"}. 120 * 121 * @return Attribute category name. 122 */ 123 public final String getName() { 124 return "job-k-octets-supported"; 125 } 126 127 } | 1 /* 2 * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package javax.print.attribute.standard; 27 28 import javax.print.attribute.Attribute; 29 import javax.print.attribute.SetOfIntegerSyntax; 30 import javax.print.attribute.SupportedValuesAttribute; 31 32 /** 33 * Class {@code JobKOctetsSupported} is a printing attribute class, a set of 34 * integers, that gives the supported values for a {@link JobKOctets JobKOctets} 35 * attribute. It is restricted to a single contiguous range of integers; 36 * multiple non-overlapping ranges are not allowed. This gives the lower and 37 * upper bounds of the total sizes of print jobs in units of K octets (1024 38 * octets) that the printer will accept. 39 * <p> 40 * <b>IPP Compatibility:</b> The {@code JobKOctetsSupported} attribute's 41 * canonical array form gives the lower and upper bound for the range of values 42 * to be included in an IPP "job-k-octets-supported" attribute. See class 43 * {@link SetOfIntegerSyntax SetOfIntegerSyntax} for an explanation of canonical 44 * array form. The category name returned by {@code getName()} gives the IPP 45 * attribute name. 46 * 47 * @author Alan Kaminsky 48 */ 49 public final class JobKOctetsSupported extends SetOfIntegerSyntax 50 implements SupportedValuesAttribute { 51 52 /** 53 * Use serialVersionUID from JDK 1.4 for interoperability. 54 */ 55 private static final long serialVersionUID = -2867871140549897443L; 56 57 /** 58 * Construct a new job K octets supported attribute containing a single 59 * range of integers. That is, only those values of JobKOctets in the one 60 * range are supported. 61 * 62 * @param lowerBound Lower bound of the range 63 * @param upperBound Upper bound of the range 64 * @throws IllegalArgumentException if a {@code null} range is specified or 65 * if a {@code non-null} range is specified with {@code lowerBound} 66 * less than zero 67 */ 68 public JobKOctetsSupported(int lowerBound, int upperBound) { 69 super (lowerBound, upperBound); 70 if (lowerBound > upperBound) { 71 throw new IllegalArgumentException("Null range specified"); 72 } else if (lowerBound < 0) { 73 throw new IllegalArgumentException 74 ("Job K octets value < 0 specified"); 75 } 76 } 77 78 /** 79 * Returns whether this job K octets supported attribute is equivalent to 80 * the passed in object. To be equivalent, all of the following conditions 81 * must be true: 82 * <ol type=1> 83 * <li>{@code object} is not {@code null}. 84 * <li>{@code object} is an instance of class {@code JobKOctetsSupported}. 85 * <li>This job K octets supported attribute's members and 86 * {@code object}'s members are the same. 87 * </ol> 88 * 89 * @param object {@code Object} to compare to 90 * @return {@code true} if {@code object} is equivalent to this job K octets 91 * supported attribute, {@code false} otherwise 92 */ 93 public boolean equals(Object object) { 94 return (super.equals (object) && 95 object instanceof JobKOctetsSupported); 96 } 97 98 /** 99 * Get the printing attribute class which is to be used as the "category" 100 * for this printing attribute value. 101 * <p> 102 * For class {@code JobKOctetsSupported}, the category is class 103 * {@code JobKOctetsSupported} itself. 104 * 105 * @return printing attribute class (category), an instance of class 106 * {@link Class java.lang.Class} 107 */ 108 public final Class<? extends Attribute> getCategory() { 109 return JobKOctetsSupported.class; 110 } 111 112 /** 113 * Get the name of the category of which this attribute value is an 114 * instance. 115 * <p> 116 * For class {@code JobKOctetsSupported}, the category name is 117 * {@code "job-k-octets-supported"}. 118 * 119 * @return attribute category name 120 */ 121 public final String getName() { 122 return "job-k-octets-supported"; 123 } 124 } |