1 7 8 package javax.print.attribute; 9 10 import java.io.Serializable ; 11 12 27 public abstract class IntegerSyntax implements Serializable , Cloneable { 28 29 private static final long serialVersionUID = 3644574816328081943L; 30 31 35 private int value; 36 37 42 protected IntegerSyntax(int value) { 43 this.value = value; 44 } 45 46 59 protected IntegerSyntax(int value, int lowerBound, int upperBound) { 60 if (lowerBound > value || value > upperBound) { 61 throw new IllegalArgumentException ("Value " + value + 62 " not in range " + lowerBound + 63 ".." + upperBound); 64 } 65 this.value = value; 66 } 67 68 72 public int getValue() { 73 return value; 74 } 75 76 94 public boolean equals(Object object) { 95 96 return (object != null && object instanceof IntegerSyntax && 97 value == ((IntegerSyntax ) object).value); 98 } 99 100 104 public int hashCode() { 105 return value; 106 } 107 108 113 public String toString() { 114 return "" + value; 115 } 116 } 117 | Popular Tags |