1 7 8 package javax.management; 9 10 11 27 public class Query extends Object { 28 29 30 34 public static final int GT = 0; 35 36 40 public static final int LT = 1; 41 42 46 public static final int GE = 2; 47 48 52 public static final int LE = 3; 53 54 58 public static final int EQ = 4; 59 60 61 65 public static final int PLUS = 0; 66 67 71 public static final int MINUS = 1; 72 73 77 public static final int TIMES = 2; 78 79 83 public static final int DIV = 3; 84 85 86 89 public Query() { 90 } 91 92 93 102 public static QueryExp and(QueryExp q1, QueryExp q2) { 103 return new AndQueryExp (q1, q2); 104 } 105 106 115 public static QueryExp or(QueryExp q1, QueryExp q2) { 116 return new OrQueryExp (q1, q2); 117 } 118 119 128 public static QueryExp gt(ValueExp v1, ValueExp v2) { 129 return new BinaryRelQueryExp (GT, v1, v2); 130 } 131 132 141 public static QueryExp geq(ValueExp v1, ValueExp v2) { 142 return new BinaryRelQueryExp (GE, v1, v2); 143 } 144 145 154 public static QueryExp leq(ValueExp v1, ValueExp v2) { 155 return new BinaryRelQueryExp (LE, v1, v2); 156 } 157 158 167 public static QueryExp lt(ValueExp v1, ValueExp v2) { 168 return new BinaryRelQueryExp (LT, v1, v2); 169 } 170 171 180 public static QueryExp eq(ValueExp v1, ValueExp v2) { 181 return new BinaryRelQueryExp (EQ, v1, v2); 182 } 183 184 194 public static QueryExp between(ValueExp v1, ValueExp v2, ValueExp v3) { 195 return new BetweenQueryExp (v1, v2, v3); 196 } 197 198 219 public static QueryExp match(AttributeValueExp a, StringValueExp s) { 220 return new MatchQueryExp (a, s); 221 } 222 223 235 public static AttributeValueExp attr(String name) { 236 return new AttributeValueExp (name); 237 } 238 239 254 public static AttributeValueExp attr(String className, String name) { 255 return new QualifiedAttributeValueExp (className, name); 256 } 257 258 269 public static AttributeValueExp classattr() { 270 return new ClassAttributeValueExp (); 271 } 272 273 280 public static QueryExp not(QueryExp queryExp) { 281 return new NotQueryExp (queryExp); 282 } 283 284 292 public static QueryExp in(ValueExp val, ValueExp valueList[]) { 293 return new InQueryExp (val, valueList); 294 } 295 296 303 public static StringValueExp value(String val) { 304 return new StringValueExp (val); 305 } 306 307 315 public static ValueExp value(Number val) { 316 return new NumericValueExp (val); 317 } 318 319 327 public static ValueExp value(int val) { 328 return new NumericValueExp (new Long (val)); 329 } 330 331 339 public static ValueExp value(long val) { 340 return new NumericValueExp (new Long (val)); 341 } 342 343 351 public static ValueExp value(float val) { 352 return new NumericValueExp (new Double (val)); 353 } 354 355 363 public static ValueExp value(double val) { 364 return new NumericValueExp (new Double (val)); 365 } 366 367 375 public static ValueExp value(boolean val) { 376 return new BooleanValueExp (val); 377 } 378 379 389 public static ValueExp plus(ValueExp value1, ValueExp value2) { 390 return new BinaryOpValueExp (PLUS, value1, value2); 391 } 392 393 402 public static ValueExp times(ValueExp value1,ValueExp value2) { 403 return new BinaryOpValueExp (TIMES, value1, value2); 404 } 405 406 415 public static ValueExp minus(ValueExp value1, ValueExp value2) { 416 return new BinaryOpValueExp (MINUS, value1, value2); 417 } 418 419 428 public static ValueExp div(ValueExp value1, ValueExp value2) { 429 return new BinaryOpValueExp (DIV, value1, value2); 430 } 431 432 441 public static QueryExp initialSubString(AttributeValueExp a, StringValueExp s) { 442 return new MatchQueryExp (a, new StringValueExp (s.getValue()+"*")); 443 } 444 445 454 public static QueryExp anySubString(AttributeValueExp a, StringValueExp s) { 455 return new MatchQueryExp (a, new StringValueExp ("*"+s.getValue()+"*")); 456 } 457 458 467 public static QueryExp finalSubString(AttributeValueExp a, StringValueExp s) { 468 return new MatchQueryExp (a, new StringValueExp ("*"+ s.getValue())); 469 } 470 } 471 | Popular Tags |