1 7 8 package javax.print.attribute.standard; 9 10 import javax.print.attribute.Attribute ; 11 import javax.print.attribute.SetOfIntegerSyntax ; 12 import javax.print.attribute.DocAttribute ; 13 import javax.print.attribute.PrintRequestAttribute ; 14 import javax.print.attribute.PrintJobAttribute ; 15 16 90 public final class PageRanges extends SetOfIntegerSyntax 91 implements DocAttribute , PrintRequestAttribute , PrintJobAttribute { 92 93 private static final long serialVersionUID = 8639895197656148392L; 94 95 96 113 public PageRanges(int[][] members) { 114 super (members); 115 if (members == null) { 116 throw new NullPointerException ("members is null"); 117 } 118 myPageRanges(); 119 } 120 139 public PageRanges(String members) { 140 super(members); 141 if (members == null) { 142 throw new NullPointerException ("members is null"); 143 } 144 myPageRanges(); 145 } 146 147 private void myPageRanges() { 148 int[][] myMembers = getMembers(); 149 int n = myMembers.length; 150 if (n == 0) { 151 throw new IllegalArgumentException ("members is zero-length"); 152 } 153 int i; 154 for (i = 0; i < n; ++ i) { 155 if (myMembers[i][0] < 1) { 156 throw new IllegalArgumentException ("Page value < 1 specified"); 157 } 158 } 159 } 160 161 171 public PageRanges(int member) { 172 super (member); 173 if (member < 1) { 174 throw new IllegalArgumentException ("Page value < 1 specified"); 175 } 176 } 177 178 190 public PageRanges(int lowerBound, int upperBound) { 191 super (lowerBound, upperBound); 192 if (lowerBound > upperBound) { 193 throw new IllegalArgumentException ("Null range specified"); 194 } else if (lowerBound < 1) { 195 throw new IllegalArgumentException ("Page value < 1 specified"); 196 } 197 } 198 199 218 public boolean equals(Object object) { 219 return (super.equals(object) && object instanceof PageRanges ); 220 } 221 222 231 public final Class <? extends Attribute > getCategory() { 232 return PageRanges .class; 233 } 234 235 243 public final String getName() { 244 return "page-ranges"; 245 } 246 247 } 248 | Popular Tags |