Lines 18-31
Link Here
|
18 |
public abstract class Constant implements TypeIds, OperatorIds { |
18 |
public abstract class Constant implements TypeIds, OperatorIds { |
19 |
|
19 |
|
20 |
public static final Constant NotAConstant = DoubleConstant.fromValue(Double.NaN); |
20 |
public static final Constant NotAConstant = DoubleConstant.fromValue(Double.NaN); |
21 |
|
21 |
|
22 |
public boolean booleanValue() { |
22 |
public boolean booleanValue() { |
23 |
|
|
|
24 |
throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotCastedInto, new String[] { typeName(), "boolean" })); //$NON-NLS-1$ |
23 |
throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotCastedInto, new String[] { typeName(), "boolean" })); //$NON-NLS-1$ |
25 |
} |
24 |
} |
26 |
|
25 |
|
27 |
public byte byteValue() { |
26 |
public byte byteValue() { |
28 |
|
|
|
29 |
throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotCastedInto, new String[] { typeName(), "byte" })); //$NON-NLS-1$ |
27 |
throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotCastedInto, new String[] { typeName(), "byte" })); //$NON-NLS-1$ |
30 |
} |
28 |
} |
31 |
|
29 |
|
Lines 195-211
Link Here
|
195 |
case (T_int<<4)+T_int : return this; |
193 |
case (T_int<<4)+T_int : return this; |
196 |
|
194 |
|
197 |
} |
195 |
} |
198 |
|
|
|
199 |
return NotAConstant; |
196 |
return NotAConstant; |
200 |
} |
197 |
} |
201 |
|
198 |
|
202 |
public char charValue() { |
199 |
public char charValue() { |
203 |
|
|
|
204 |
throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotCastedInto, new String[] { typeName(), "char" })); //$NON-NLS-1$ |
200 |
throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotCastedInto, new String[] { typeName(), "char" })); //$NON-NLS-1$ |
205 |
} |
201 |
} |
206 |
|
202 |
|
207 |
public static final Constant computeConstantOperation(Constant cst, int id, int operator) { |
203 |
public static final Constant computeConstantOperation(Constant cst, int id, int operator) { |
208 |
|
|
|
209 |
switch (operator) { |
204 |
switch (operator) { |
210 |
case NOT : |
205 |
case NOT : |
211 |
return BooleanConstant.fromValue(!cst.booleanValue()); |
206 |
return BooleanConstant.fromValue(!cst.booleanValue()); |
Lines 245-251
Link Here
|
245 |
} |
240 |
} |
246 |
|
241 |
|
247 |
public static final Constant computeConstantOperation(Constant left, int leftId, int operator, Constant right, int rightId) { |
242 |
public static final Constant computeConstantOperation(Constant left, int leftId, int operator, Constant right, int rightId) { |
248 |
|
|
|
249 |
switch (operator) { |
243 |
switch (operator) { |
250 |
case AND : return computeConstantOperationAND (left,leftId,right,rightId); |
244 |
case AND : return computeConstantOperationAND (left,leftId,right,rightId); |
251 |
case AND_AND : return computeConstantOperationAND_AND (left,leftId,right,rightId); |
245 |
case AND_AND : return computeConstantOperationAND_AND (left,leftId,right,rightId); |
Lines 264-276
Link Here
|
264 |
case RIGHT_SHIFT: return computeConstantOperationRIGHT_SHIFT(left,leftId,right,rightId); |
258 |
case RIGHT_SHIFT: return computeConstantOperationRIGHT_SHIFT(left,leftId,right,rightId); |
265 |
case UNSIGNED_RIGHT_SHIFT: return computeConstantOperationUNSIGNED_RIGHT_SHIFT(left,leftId,right,rightId); |
259 |
case UNSIGNED_RIGHT_SHIFT: return computeConstantOperationUNSIGNED_RIGHT_SHIFT(left,leftId,right,rightId); |
266 |
case XOR : return computeConstantOperationXOR (left,leftId,right,rightId); |
260 |
case XOR : return computeConstantOperationXOR (left,leftId,right,rightId); |
267 |
|
|
|
268 |
default : return NotAConstant; |
261 |
default : return NotAConstant; |
269 |
} |
262 |
} |
270 |
} |
263 |
} |
271 |
|
264 |
|
272 |
public static final Constant computeConstantOperationAND(Constant left, int leftId, Constant right, int rightId) { |
265 |
public static final Constant computeConstantOperationAND(Constant left, int leftId, Constant right, int rightId) { |
273 |
|
|
|
274 |
switch (leftId){ |
266 |
switch (leftId){ |
275 |
case T_boolean : return BooleanConstant.fromValue(left.booleanValue() & right.booleanValue()); |
267 |
case T_boolean : return BooleanConstant.fromValue(left.booleanValue() & right.booleanValue()); |
276 |
case T_char : |
268 |
case T_char : |
Lines 281-287
Link Here
|
281 |
case T_int: return IntConstant.fromValue(left.charValue() & right.intValue()); |
273 |
case T_int: return IntConstant.fromValue(left.charValue() & right.intValue()); |
282 |
case T_long: return LongConstant.fromValue(left.charValue() & right.longValue()); |
274 |
case T_long: return LongConstant.fromValue(left.charValue() & right.longValue()); |
283 |
} |
275 |
} |
284 |
break; |
276 |
break; |
285 |
case T_byte : |
277 |
case T_byte : |
286 |
switch (rightId){ |
278 |
switch (rightId){ |
287 |
case T_char : return IntConstant.fromValue(left.byteValue() & right.charValue()); |
279 |
case T_char : return IntConstant.fromValue(left.byteValue() & right.charValue()); |
Lines 290-296
Link Here
|
290 |
case T_int: return IntConstant.fromValue(left.byteValue() & right.intValue()); |
282 |
case T_int: return IntConstant.fromValue(left.byteValue() & right.intValue()); |
291 |
case T_long: return LongConstant.fromValue(left.byteValue() & right.longValue()); |
283 |
case T_long: return LongConstant.fromValue(left.byteValue() & right.longValue()); |
292 |
} |
284 |
} |
293 |
break; |
285 |
break; |
294 |
case T_short : |
286 |
case T_short : |
295 |
switch (rightId){ |
287 |
switch (rightId){ |
296 |
case T_char : return IntConstant.fromValue(left.shortValue() & right.charValue()); |
288 |
case T_char : return IntConstant.fromValue(left.shortValue() & right.charValue()); |
Lines 299-305
Link Here
|
299 |
case T_int: return IntConstant.fromValue(left.shortValue() & right.intValue()); |
291 |
case T_int: return IntConstant.fromValue(left.shortValue() & right.intValue()); |
300 |
case T_long: return LongConstant.fromValue(left.shortValue() & right.longValue()); |
292 |
case T_long: return LongConstant.fromValue(left.shortValue() & right.longValue()); |
301 |
} |
293 |
} |
302 |
break; |
294 |
break; |
303 |
case T_int : |
295 |
case T_int : |
304 |
switch (rightId){ |
296 |
switch (rightId){ |
305 |
case T_char : return IntConstant.fromValue(left.intValue() & right.charValue()); |
297 |
case T_char : return IntConstant.fromValue(left.intValue() & right.charValue()); |
Lines 308-314
Link Here
|
308 |
case T_int: return IntConstant.fromValue(left.intValue() & right.intValue()); |
300 |
case T_int: return IntConstant.fromValue(left.intValue() & right.intValue()); |
309 |
case T_long: return LongConstant.fromValue(left.intValue() & right.longValue()); |
301 |
case T_long: return LongConstant.fromValue(left.intValue() & right.longValue()); |
310 |
} |
302 |
} |
311 |
break; |
303 |
break; |
312 |
case T_long : |
304 |
case T_long : |
313 |
switch (rightId){ |
305 |
switch (rightId){ |
314 |
case T_char : return LongConstant.fromValue(left.longValue() & right.charValue()); |
306 |
case T_char : return LongConstant.fromValue(left.longValue() & right.charValue()); |
Lines 317-335
Link Here
|
317 |
case T_int: return LongConstant.fromValue(left.longValue() & right.intValue()); |
309 |
case T_int: return LongConstant.fromValue(left.longValue() & right.intValue()); |
318 |
case T_long: return LongConstant.fromValue(left.longValue() & right.longValue()); |
310 |
case T_long: return LongConstant.fromValue(left.longValue() & right.longValue()); |
319 |
} |
311 |
} |
320 |
} |
312 |
} |
321 |
|
|
|
322 |
return NotAConstant; |
313 |
return NotAConstant; |
323 |
} |
314 |
} |
324 |
|
315 |
|
325 |
public static final Constant computeConstantOperationAND_AND(Constant left, int leftId, Constant right, int rightId) { |
316 |
public static final Constant computeConstantOperationAND_AND(Constant left, int leftId, Constant right, int rightId) { |
326 |
|
|
|
327 |
return BooleanConstant.fromValue(left.booleanValue() && right.booleanValue()); |
317 |
return BooleanConstant.fromValue(left.booleanValue() && right.booleanValue()); |
328 |
} |
318 |
} |
329 |
|
319 |
|
330 |
public static final Constant computeConstantOperationDIVIDE(Constant left, int leftId, Constant right, int rightId) { |
320 |
public static final Constant computeConstantOperationDIVIDE(Constant left, int leftId, Constant right, int rightId) { |
331 |
// division by zero must be handled outside this method (error reporting) |
321 |
// division by zero must be handled outside this method (error reporting) |
332 |
|
|
|
333 |
switch (leftId){ |
322 |
switch (leftId){ |
334 |
case T_char : |
323 |
case T_char : |
335 |
switch (rightId){ |
324 |
switch (rightId){ |
Lines 341-347
Link Here
|
341 |
case T_int: return IntConstant.fromValue(left.charValue() / right.intValue()); |
330 |
case T_int: return IntConstant.fromValue(left.charValue() / right.intValue()); |
342 |
case T_long: return LongConstant.fromValue(left.charValue() / right.longValue()); |
331 |
case T_long: return LongConstant.fromValue(left.charValue() / right.longValue()); |
343 |
} |
332 |
} |
344 |
break; |
333 |
break; |
345 |
case T_float : |
334 |
case T_float : |
346 |
switch (rightId){ |
335 |
switch (rightId){ |
347 |
case T_char : return FloatConstant.fromValue(left.floatValue() / right.charValue()); |
336 |
case T_char : return FloatConstant.fromValue(left.floatValue() / right.charValue()); |
Lines 352-358
Link Here
|
352 |
case T_int: return FloatConstant.fromValue(left.floatValue() / right.intValue()); |
341 |
case T_int: return FloatConstant.fromValue(left.floatValue() / right.intValue()); |
353 |
case T_long: return FloatConstant.fromValue(left.floatValue() / right.longValue()); |
342 |
case T_long: return FloatConstant.fromValue(left.floatValue() / right.longValue()); |
354 |
} |
343 |
} |
355 |
break; |
344 |
break; |
356 |
case T_double : |
345 |
case T_double : |
357 |
switch (rightId){ |
346 |
switch (rightId){ |
358 |
case T_char : return DoubleConstant.fromValue(left.doubleValue() / right.charValue()); |
347 |
case T_char : return DoubleConstant.fromValue(left.doubleValue() / right.charValue()); |
Lines 363-369
Link Here
|
363 |
case T_int: return DoubleConstant.fromValue(left.doubleValue() / right.intValue()); |
352 |
case T_int: return DoubleConstant.fromValue(left.doubleValue() / right.intValue()); |
364 |
case T_long: return DoubleConstant.fromValue(left.doubleValue() / right.longValue()); |
353 |
case T_long: return DoubleConstant.fromValue(left.doubleValue() / right.longValue()); |
365 |
} |
354 |
} |
366 |
break; |
355 |
break; |
367 |
case T_byte : |
356 |
case T_byte : |
368 |
switch (rightId){ |
357 |
switch (rightId){ |
369 |
case T_char : return IntConstant.fromValue(left.byteValue() / right.charValue()); |
358 |
case T_char : return IntConstant.fromValue(left.byteValue() / right.charValue()); |
Lines 374-380
Link Here
|
374 |
case T_int: return IntConstant.fromValue(left.byteValue() / right.intValue()); |
363 |
case T_int: return IntConstant.fromValue(left.byteValue() / right.intValue()); |
375 |
case T_long: return LongConstant.fromValue(left.byteValue() / right.longValue()); |
364 |
case T_long: return LongConstant.fromValue(left.byteValue() / right.longValue()); |
376 |
} |
365 |
} |
377 |
break; |
366 |
break; |
378 |
case T_short : |
367 |
case T_short : |
379 |
switch (rightId){ |
368 |
switch (rightId){ |
380 |
case T_char : return IntConstant.fromValue(left.shortValue() / right.charValue()); |
369 |
case T_char : return IntConstant.fromValue(left.shortValue() / right.charValue()); |
Lines 385-391
Link Here
|
385 |
case T_int: return IntConstant.fromValue(left.shortValue() / right.intValue()); |
374 |
case T_int: return IntConstant.fromValue(left.shortValue() / right.intValue()); |
386 |
case T_long: return LongConstant.fromValue(left.shortValue() / right.longValue()); |
375 |
case T_long: return LongConstant.fromValue(left.shortValue() / right.longValue()); |
387 |
} |
376 |
} |
388 |
break; |
377 |
break; |
389 |
case T_int : |
378 |
case T_int : |
390 |
switch (rightId){ |
379 |
switch (rightId){ |
391 |
case T_char : return IntConstant.fromValue(left.intValue() / right.charValue()); |
380 |
case T_char : return IntConstant.fromValue(left.intValue() / right.charValue()); |
Lines 396-402
Link Here
|
396 |
case T_int: return IntConstant.fromValue(left.intValue() / right.intValue()); |
385 |
case T_int: return IntConstant.fromValue(left.intValue() / right.intValue()); |
397 |
case T_long: return LongConstant.fromValue(left.intValue() / right.longValue()); |
386 |
case T_long: return LongConstant.fromValue(left.intValue() / right.longValue()); |
398 |
} |
387 |
} |
399 |
break; |
388 |
break; |
400 |
case T_long : |
389 |
case T_long : |
401 |
switch (rightId){ |
390 |
switch (rightId){ |
402 |
case T_char : return LongConstant.fromValue(left.longValue() / right.charValue()); |
391 |
case T_char : return LongConstant.fromValue(left.longValue() / right.charValue()); |
Lines 407-426
Link Here
|
407 |
case T_int: return LongConstant.fromValue(left.longValue() / right.intValue()); |
396 |
case T_int: return LongConstant.fromValue(left.longValue() / right.intValue()); |
408 |
case T_long: return LongConstant.fromValue(left.longValue() / right.longValue()); |
397 |
case T_long: return LongConstant.fromValue(left.longValue() / right.longValue()); |
409 |
} |
398 |
} |
410 |
|
399 |
} |
411 |
} |
|
|
412 |
|
413 |
return NotAConstant; |
400 |
return NotAConstant; |
414 |
} |
401 |
} |
415 |
|
402 |
|
416 |
public static final Constant computeConstantOperationEQUAL_EQUAL(Constant left, int leftId, Constant right, int rightId) { |
403 |
public static final Constant computeConstantOperationEQUAL_EQUAL(Constant left, int leftId, Constant right, int rightId) { |
417 |
|
|
|
418 |
switch (leftId){ |
404 |
switch (leftId){ |
419 |
case T_boolean : |
405 |
case T_boolean : |
420 |
if (rightId == T_boolean) { |
406 |
if (rightId == T_boolean) { |
421 |
return BooleanConstant.fromValue(left.booleanValue() == right.booleanValue()); |
407 |
return BooleanConstant.fromValue(left.booleanValue() == right.booleanValue()); |
422 |
} |
408 |
} |
423 |
break; |
409 |
break; |
424 |
case T_char : |
410 |
case T_char : |
425 |
switch (rightId){ |
411 |
switch (rightId){ |
426 |
case T_char : return BooleanConstant.fromValue(left.charValue() == right.charValue()); |
412 |
case T_char : return BooleanConstant.fromValue(left.charValue() == right.charValue()); |
Lines 430-436
Link Here
|
430 |
case T_short: return BooleanConstant.fromValue(left.charValue() == right.shortValue()); |
416 |
case T_short: return BooleanConstant.fromValue(left.charValue() == right.shortValue()); |
431 |
case T_int: return BooleanConstant.fromValue(left.charValue() == right.intValue()); |
417 |
case T_int: return BooleanConstant.fromValue(left.charValue() == right.intValue()); |
432 |
case T_long: return BooleanConstant.fromValue(left.charValue() == right.longValue());} |
418 |
case T_long: return BooleanConstant.fromValue(left.charValue() == right.longValue());} |
433 |
break; |
419 |
break; |
434 |
case T_float : |
420 |
case T_float : |
435 |
switch (rightId){ |
421 |
switch (rightId){ |
436 |
case T_char : return BooleanConstant.fromValue(left.floatValue() == right.charValue()); |
422 |
case T_char : return BooleanConstant.fromValue(left.floatValue() == right.charValue()); |
Lines 441-447
Link Here
|
441 |
case T_int: return BooleanConstant.fromValue(left.floatValue() == right.intValue()); |
427 |
case T_int: return BooleanConstant.fromValue(left.floatValue() == right.intValue()); |
442 |
case T_long: return BooleanConstant.fromValue(left.floatValue() == right.longValue()); |
428 |
case T_long: return BooleanConstant.fromValue(left.floatValue() == right.longValue()); |
443 |
} |
429 |
} |
444 |
break; |
430 |
break; |
445 |
case T_double : |
431 |
case T_double : |
446 |
switch (rightId){ |
432 |
switch (rightId){ |
447 |
case T_char : return BooleanConstant.fromValue(left.doubleValue() == right.charValue()); |
433 |
case T_char : return BooleanConstant.fromValue(left.doubleValue() == right.charValue()); |
Lines 452-458
Link Here
|
452 |
case T_int: return BooleanConstant.fromValue(left.doubleValue() == right.intValue()); |
438 |
case T_int: return BooleanConstant.fromValue(left.doubleValue() == right.intValue()); |
453 |
case T_long: return BooleanConstant.fromValue(left.doubleValue() == right.longValue()); |
439 |
case T_long: return BooleanConstant.fromValue(left.doubleValue() == right.longValue()); |
454 |
} |
440 |
} |
455 |
break; |
441 |
break; |
456 |
case T_byte : |
442 |
case T_byte : |
457 |
switch (rightId){ |
443 |
switch (rightId){ |
458 |
case T_char : return BooleanConstant.fromValue(left.byteValue() == right.charValue()); |
444 |
case T_char : return BooleanConstant.fromValue(left.byteValue() == right.charValue()); |
Lines 463-469
Link Here
|
463 |
case T_int: return BooleanConstant.fromValue(left.byteValue() == right.intValue()); |
449 |
case T_int: return BooleanConstant.fromValue(left.byteValue() == right.intValue()); |
464 |
case T_long: return BooleanConstant.fromValue(left.byteValue() == right.longValue()); |
450 |
case T_long: return BooleanConstant.fromValue(left.byteValue() == right.longValue()); |
465 |
} |
451 |
} |
466 |
break; |
452 |
break; |
467 |
case T_short : |
453 |
case T_short : |
468 |
switch (rightId){ |
454 |
switch (rightId){ |
469 |
case T_char : return BooleanConstant.fromValue(left.shortValue() == right.charValue()); |
455 |
case T_char : return BooleanConstant.fromValue(left.shortValue() == right.charValue()); |
Lines 474-480
Link Here
|
474 |
case T_int: return BooleanConstant.fromValue(left.shortValue() == right.intValue()); |
460 |
case T_int: return BooleanConstant.fromValue(left.shortValue() == right.intValue()); |
475 |
case T_long: return BooleanConstant.fromValue(left.shortValue() == right.longValue()); |
461 |
case T_long: return BooleanConstant.fromValue(left.shortValue() == right.longValue()); |
476 |
} |
462 |
} |
477 |
break; |
463 |
break; |
478 |
case T_int : |
464 |
case T_int : |
479 |
switch (rightId){ |
465 |
switch (rightId){ |
480 |
case T_char : return BooleanConstant.fromValue(left.intValue() == right.charValue()); |
466 |
case T_char : return BooleanConstant.fromValue(left.intValue() == right.charValue()); |
Lines 485-491
Link Here
|
485 |
case T_int: return BooleanConstant.fromValue(left.intValue() == right.intValue()); |
471 |
case T_int: return BooleanConstant.fromValue(left.intValue() == right.intValue()); |
486 |
case T_long: return BooleanConstant.fromValue(left.intValue() == right.longValue()); |
472 |
case T_long: return BooleanConstant.fromValue(left.intValue() == right.longValue()); |
487 |
} |
473 |
} |
488 |
break; |
474 |
break; |
489 |
case T_long : |
475 |
case T_long : |
490 |
switch (rightId){ |
476 |
switch (rightId){ |
491 |
case T_char : return BooleanConstant.fromValue(left.longValue() == right.charValue()); |
477 |
case T_char : return BooleanConstant.fromValue(left.longValue() == right.charValue()); |
Lines 496-509
Link Here
|
496 |
case T_int: return BooleanConstant.fromValue(left.longValue() == right.intValue()); |
482 |
case T_int: return BooleanConstant.fromValue(left.longValue() == right.intValue()); |
497 |
case T_long: return BooleanConstant.fromValue(left.longValue() == right.longValue()); |
483 |
case T_long: return BooleanConstant.fromValue(left.longValue() == right.longValue()); |
498 |
} |
484 |
} |
499 |
break; |
485 |
break; |
500 |
case T_JavaLangString : |
486 |
case T_JavaLangString : |
501 |
if (rightId == T_JavaLangString) { |
487 |
if (rightId == T_JavaLangString) { |
502 |
//String are interned in th compiler==>thus if two string constant |
488 |
//String are interned in th compiler==>thus if two string constant |
503 |
//get to be compared, it is an equal on the vale which is done |
489 |
//get to be compared, it is an equal on the vale which is done |
504 |
return BooleanConstant.fromValue(((StringConstant)left).hasSameValue(right)); |
490 |
return BooleanConstant.fromValue(((StringConstant)left).hasSameValue(right)); |
505 |
} |
491 |
} |
506 |
break; |
492 |
break; |
507 |
case T_null : |
493 |
case T_null : |
508 |
if (rightId == T_JavaLangString) { |
494 |
if (rightId == T_JavaLangString) { |
509 |
return BooleanConstant.fromValue(false); |
495 |
return BooleanConstant.fromValue(false); |
Lines 512-524
Link Here
|
512 |
return BooleanConstant.fromValue(true); |
498 |
return BooleanConstant.fromValue(true); |
513 |
} |
499 |
} |
514 |
} |
500 |
} |
515 |
} |
501 |
} |
516 |
|
|
|
517 |
return BooleanConstant.fromValue(false); |
502 |
return BooleanConstant.fromValue(false); |
518 |
} |
503 |
} |
519 |
|
504 |
|
520 |
public static final Constant computeConstantOperationGREATER(Constant left, int leftId, Constant right, int rightId) { |
505 |
public static final Constant computeConstantOperationGREATER(Constant left, int leftId, Constant right, int rightId) { |
521 |
|
|
|
522 |
switch (leftId){ |
506 |
switch (leftId){ |
523 |
case T_char : |
507 |
case T_char : |
524 |
switch (rightId){ |
508 |
switch (rightId){ |
Lines 530-536
Link Here
|
530 |
case T_int: return BooleanConstant.fromValue(left.charValue() > right.intValue()); |
514 |
case T_int: return BooleanConstant.fromValue(left.charValue() > right.intValue()); |
531 |
case T_long: return BooleanConstant.fromValue(left.charValue() > right.longValue()); |
515 |
case T_long: return BooleanConstant.fromValue(left.charValue() > right.longValue()); |
532 |
} |
516 |
} |
533 |
break; |
517 |
break; |
534 |
case T_float : |
518 |
case T_float : |
535 |
switch (rightId){ |
519 |
switch (rightId){ |
536 |
case T_char : return BooleanConstant.fromValue(left.floatValue() > right.charValue()); |
520 |
case T_char : return BooleanConstant.fromValue(left.floatValue() > right.charValue()); |
Lines 541-547
Link Here
|
541 |
case T_int: return BooleanConstant.fromValue(left.floatValue() > right.intValue()); |
525 |
case T_int: return BooleanConstant.fromValue(left.floatValue() > right.intValue()); |
542 |
case T_long: return BooleanConstant.fromValue(left.floatValue() > right.longValue()); |
526 |
case T_long: return BooleanConstant.fromValue(left.floatValue() > right.longValue()); |
543 |
} |
527 |
} |
544 |
break; |
528 |
break; |
545 |
case T_double : |
529 |
case T_double : |
546 |
switch (rightId){ |
530 |
switch (rightId){ |
547 |
case T_char : return BooleanConstant.fromValue(left.doubleValue() > right.charValue()); |
531 |
case T_char : return BooleanConstant.fromValue(left.doubleValue() > right.charValue()); |
Lines 552-558
Link Here
|
552 |
case T_int: return BooleanConstant.fromValue(left.doubleValue() > right.intValue()); |
536 |
case T_int: return BooleanConstant.fromValue(left.doubleValue() > right.intValue()); |
553 |
case T_long: return BooleanConstant.fromValue(left.doubleValue() > right.longValue()); |
537 |
case T_long: return BooleanConstant.fromValue(left.doubleValue() > right.longValue()); |
554 |
} |
538 |
} |
555 |
break; |
539 |
break; |
556 |
case T_byte : |
540 |
case T_byte : |
557 |
switch (rightId){ |
541 |
switch (rightId){ |
558 |
case T_char : return BooleanConstant.fromValue(left.byteValue() > right.charValue()); |
542 |
case T_char : return BooleanConstant.fromValue(left.byteValue() > right.charValue()); |
Lines 563-569
Link Here
|
563 |
case T_int: return BooleanConstant.fromValue(left.byteValue() > right.intValue()); |
547 |
case T_int: return BooleanConstant.fromValue(left.byteValue() > right.intValue()); |
564 |
case T_long: return BooleanConstant.fromValue(left.byteValue() > right.longValue()); |
548 |
case T_long: return BooleanConstant.fromValue(left.byteValue() > right.longValue()); |
565 |
} |
549 |
} |
566 |
break; |
550 |
break; |
567 |
case T_short : |
551 |
case T_short : |
568 |
switch (rightId){ |
552 |
switch (rightId){ |
569 |
case T_char : return BooleanConstant.fromValue(left.shortValue() > right.charValue()); |
553 |
case T_char : return BooleanConstant.fromValue(left.shortValue() > right.charValue()); |
Lines 574-580
Link Here
|
574 |
case T_int: return BooleanConstant.fromValue(left.shortValue() > right.intValue()); |
558 |
case T_int: return BooleanConstant.fromValue(left.shortValue() > right.intValue()); |
575 |
case T_long: return BooleanConstant.fromValue(left.shortValue() > right.longValue()); |
559 |
case T_long: return BooleanConstant.fromValue(left.shortValue() > right.longValue()); |
576 |
} |
560 |
} |
577 |
break; |
561 |
break; |
578 |
case T_int : |
562 |
case T_int : |
579 |
switch (rightId){ |
563 |
switch (rightId){ |
580 |
case T_char : return BooleanConstant.fromValue(left.intValue() > right.charValue()); |
564 |
case T_char : return BooleanConstant.fromValue(left.intValue() > right.charValue()); |
Lines 585-591
Link Here
|
585 |
case T_int: return BooleanConstant.fromValue(left.intValue() > right.intValue()); |
569 |
case T_int: return BooleanConstant.fromValue(left.intValue() > right.intValue()); |
586 |
case T_long: return BooleanConstant.fromValue(left.intValue() > right.longValue()); |
570 |
case T_long: return BooleanConstant.fromValue(left.intValue() > right.longValue()); |
587 |
} |
571 |
} |
588 |
break; |
572 |
break; |
589 |
case T_long : |
573 |
case T_long : |
590 |
switch (rightId){ |
574 |
switch (rightId){ |
591 |
case T_char : return BooleanConstant.fromValue(left.longValue() > right.charValue()); |
575 |
case T_char : return BooleanConstant.fromValue(left.longValue() > right.charValue()); |
Lines 597-609
Link Here
|
597 |
case T_long: return BooleanConstant.fromValue(left.longValue() > right.longValue()); |
581 |
case T_long: return BooleanConstant.fromValue(left.longValue() > right.longValue()); |
598 |
} |
582 |
} |
599 |
|
583 |
|
600 |
} |
584 |
} |
601 |
|
|
|
602 |
return NotAConstant; |
585 |
return NotAConstant; |
603 |
} |
586 |
} |
604 |
|
587 |
|
605 |
public static final Constant computeConstantOperationGREATER_EQUAL(Constant left, int leftId, Constant right, int rightId) { |
588 |
public static final Constant computeConstantOperationGREATER_EQUAL(Constant left, int leftId, Constant right, int rightId) { |
606 |
|
|
|
607 |
switch (leftId){ |
589 |
switch (leftId){ |
608 |
case T_char : |
590 |
case T_char : |
609 |
switch (rightId){ |
591 |
switch (rightId){ |
Lines 615-621
Link Here
|
615 |
case T_int: return BooleanConstant.fromValue(left.charValue() >= right.intValue()); |
597 |
case T_int: return BooleanConstant.fromValue(left.charValue() >= right.intValue()); |
616 |
case T_long: return BooleanConstant.fromValue(left.charValue() >= right.longValue()); |
598 |
case T_long: return BooleanConstant.fromValue(left.charValue() >= right.longValue()); |
617 |
} |
599 |
} |
618 |
break; |
600 |
break; |
619 |
case T_float : |
601 |
case T_float : |
620 |
switch (rightId){ |
602 |
switch (rightId){ |
621 |
case T_char : return BooleanConstant.fromValue(left.floatValue() >= right.charValue()); |
603 |
case T_char : return BooleanConstant.fromValue(left.floatValue() >= right.charValue()); |
Lines 626-632
Link Here
|
626 |
case T_int: return BooleanConstant.fromValue(left.floatValue() >= right.intValue()); |
608 |
case T_int: return BooleanConstant.fromValue(left.floatValue() >= right.intValue()); |
627 |
case T_long: return BooleanConstant.fromValue(left.floatValue() >= right.longValue()); |
609 |
case T_long: return BooleanConstant.fromValue(left.floatValue() >= right.longValue()); |
628 |
} |
610 |
} |
629 |
break; |
611 |
break; |
630 |
case T_double : |
612 |
case T_double : |
631 |
switch (rightId){ |
613 |
switch (rightId){ |
632 |
case T_char : return BooleanConstant.fromValue(left.doubleValue() >= right.charValue()); |
614 |
case T_char : return BooleanConstant.fromValue(left.doubleValue() >= right.charValue()); |
Lines 637-643
Link Here
|
637 |
case T_int: return BooleanConstant.fromValue(left.doubleValue() >= right.intValue()); |
619 |
case T_int: return BooleanConstant.fromValue(left.doubleValue() >= right.intValue()); |
638 |
case T_long: return BooleanConstant.fromValue(left.doubleValue() >= right.longValue()); |
620 |
case T_long: return BooleanConstant.fromValue(left.doubleValue() >= right.longValue()); |
639 |
} |
621 |
} |
640 |
break; |
622 |
break; |
641 |
case T_byte : |
623 |
case T_byte : |
642 |
switch (rightId){ |
624 |
switch (rightId){ |
643 |
case T_char : return BooleanConstant.fromValue(left.byteValue() >= right.charValue()); |
625 |
case T_char : return BooleanConstant.fromValue(left.byteValue() >= right.charValue()); |
Lines 648-654
Link Here
|
648 |
case T_int: return BooleanConstant.fromValue(left.byteValue() >= right.intValue()); |
630 |
case T_int: return BooleanConstant.fromValue(left.byteValue() >= right.intValue()); |
649 |
case T_long: return BooleanConstant.fromValue(left.byteValue() >= right.longValue()); |
631 |
case T_long: return BooleanConstant.fromValue(left.byteValue() >= right.longValue()); |
650 |
} |
632 |
} |
651 |
break; |
633 |
break; |
652 |
case T_short : |
634 |
case T_short : |
653 |
switch (rightId){ |
635 |
switch (rightId){ |
654 |
case T_char : return BooleanConstant.fromValue(left.shortValue() >= right.charValue()); |
636 |
case T_char : return BooleanConstant.fromValue(left.shortValue() >= right.charValue()); |
Lines 659-665
Link Here
|
659 |
case T_int: return BooleanConstant.fromValue(left.shortValue() >= right.intValue()); |
641 |
case T_int: return BooleanConstant.fromValue(left.shortValue() >= right.intValue()); |
660 |
case T_long: return BooleanConstant.fromValue(left.shortValue() >= right.longValue()); |
642 |
case T_long: return BooleanConstant.fromValue(left.shortValue() >= right.longValue()); |
661 |
} |
643 |
} |
662 |
break; |
644 |
break; |
663 |
case T_int : |
645 |
case T_int : |
664 |
switch (rightId){ |
646 |
switch (rightId){ |
665 |
case T_char : return BooleanConstant.fromValue(left.intValue() >= right.charValue()); |
647 |
case T_char : return BooleanConstant.fromValue(left.intValue() >= right.charValue()); |
Lines 670-676
Link Here
|
670 |
case T_int: return BooleanConstant.fromValue(left.intValue() >= right.intValue()); |
652 |
case T_int: return BooleanConstant.fromValue(left.intValue() >= right.intValue()); |
671 |
case T_long: return BooleanConstant.fromValue(left.intValue() >= right.longValue()); |
653 |
case T_long: return BooleanConstant.fromValue(left.intValue() >= right.longValue()); |
672 |
} |
654 |
} |
673 |
break; |
655 |
break; |
674 |
case T_long : |
656 |
case T_long : |
675 |
switch (rightId){ |
657 |
switch (rightId){ |
676 |
case T_char : return BooleanConstant.fromValue(left.longValue() >= right.charValue()); |
658 |
case T_char : return BooleanConstant.fromValue(left.longValue() >= right.charValue()); |
Lines 681-694
Link Here
|
681 |
case T_int: return BooleanConstant.fromValue(left.longValue() >= right.intValue()); |
663 |
case T_int: return BooleanConstant.fromValue(left.longValue() >= right.intValue()); |
682 |
case T_long: return BooleanConstant.fromValue(left.longValue() >= right.longValue()); |
664 |
case T_long: return BooleanConstant.fromValue(left.longValue() >= right.longValue()); |
683 |
} |
665 |
} |
684 |
|
666 |
} |
685 |
} |
|
|
686 |
|
687 |
return NotAConstant; |
667 |
return NotAConstant; |
688 |
} |
668 |
} |
689 |
|
669 |
|
690 |
public static final Constant computeConstantOperationLEFT_SHIFT(Constant left, int leftId, Constant right, int rightId) { |
670 |
public static final Constant computeConstantOperationLEFT_SHIFT(Constant left, int leftId, Constant right, int rightId) { |
691 |
|
|
|
692 |
switch (leftId){ |
671 |
switch (leftId){ |
693 |
case T_char : |
672 |
case T_char : |
694 |
switch (rightId){ |
673 |
switch (rightId){ |
Lines 698-704
Link Here
|
698 |
case T_int: return IntConstant.fromValue(left.charValue() << right.intValue()); |
677 |
case T_int: return IntConstant.fromValue(left.charValue() << right.intValue()); |
699 |
case T_long: return IntConstant.fromValue(left.charValue() << right.longValue()); |
678 |
case T_long: return IntConstant.fromValue(left.charValue() << right.longValue()); |
700 |
} |
679 |
} |
701 |
break; |
680 |
break; |
702 |
case T_byte : |
681 |
case T_byte : |
703 |
switch (rightId){ |
682 |
switch (rightId){ |
704 |
case T_char : return IntConstant.fromValue(left.byteValue() << right.charValue()); |
683 |
case T_char : return IntConstant.fromValue(left.byteValue() << right.charValue()); |
Lines 707-713
Link Here
|
707 |
case T_int: return IntConstant.fromValue(left.byteValue() << right.intValue()); |
686 |
case T_int: return IntConstant.fromValue(left.byteValue() << right.intValue()); |
708 |
case T_long: return IntConstant.fromValue(left.byteValue() << right.longValue()); |
687 |
case T_long: return IntConstant.fromValue(left.byteValue() << right.longValue()); |
709 |
} |
688 |
} |
710 |
break; |
689 |
break; |
711 |
case T_short : |
690 |
case T_short : |
712 |
switch (rightId){ |
691 |
switch (rightId){ |
713 |
case T_char : return IntConstant.fromValue(left.shortValue() << right.charValue()); |
692 |
case T_char : return IntConstant.fromValue(left.shortValue() << right.charValue()); |
Lines 716-722
Link Here
|
716 |
case T_int: return IntConstant.fromValue(left.shortValue() << right.intValue()); |
695 |
case T_int: return IntConstant.fromValue(left.shortValue() << right.intValue()); |
717 |
case T_long: return IntConstant.fromValue(left.shortValue() << right.longValue()); |
696 |
case T_long: return IntConstant.fromValue(left.shortValue() << right.longValue()); |
718 |
} |
697 |
} |
719 |
break; |
698 |
break; |
720 |
case T_int : |
699 |
case T_int : |
721 |
switch (rightId){ |
700 |
switch (rightId){ |
722 |
case T_char : return IntConstant.fromValue(left.intValue() << right.charValue()); |
701 |
case T_char : return IntConstant.fromValue(left.intValue() << right.charValue()); |
Lines 725-731
Link Here
|
725 |
case T_int: return IntConstant.fromValue(left.intValue() << right.intValue()); |
704 |
case T_int: return IntConstant.fromValue(left.intValue() << right.intValue()); |
726 |
case T_long: return IntConstant.fromValue(left.intValue() << right.longValue()); |
705 |
case T_long: return IntConstant.fromValue(left.intValue() << right.longValue()); |
727 |
} |
706 |
} |
728 |
break; |
707 |
break; |
729 |
case T_long : |
708 |
case T_long : |
730 |
switch (rightId){ |
709 |
switch (rightId){ |
731 |
case T_char : return LongConstant.fromValue(left.longValue() << right.charValue()); |
710 |
case T_char : return LongConstant.fromValue(left.longValue() << right.charValue()); |
Lines 734-747
Link Here
|
734 |
case T_int: return LongConstant.fromValue(left.longValue() << right.intValue()); |
713 |
case T_int: return LongConstant.fromValue(left.longValue() << right.intValue()); |
735 |
case T_long: return LongConstant.fromValue(left.longValue() << right.longValue()); |
714 |
case T_long: return LongConstant.fromValue(left.longValue() << right.longValue()); |
736 |
} |
715 |
} |
737 |
|
716 |
} |
738 |
} |
|
|
739 |
|
740 |
return NotAConstant; |
717 |
return NotAConstant; |
741 |
} |
718 |
} |
742 |
|
719 |
|
743 |
public static final Constant computeConstantOperationLESS(Constant left, int leftId, Constant right, int rightId) { |
720 |
public static final Constant computeConstantOperationLESS(Constant left, int leftId, Constant right, int rightId) { |
744 |
|
|
|
745 |
switch (leftId){ |
721 |
switch (leftId){ |
746 |
case T_char : |
722 |
case T_char : |
747 |
switch (rightId){ |
723 |
switch (rightId){ |
Lines 753-759
Link Here
|
753 |
case T_int: return BooleanConstant.fromValue(left.charValue() < right.intValue()); |
729 |
case T_int: return BooleanConstant.fromValue(left.charValue() < right.intValue()); |
754 |
case T_long: return BooleanConstant.fromValue(left.charValue() < right.longValue()); |
730 |
case T_long: return BooleanConstant.fromValue(left.charValue() < right.longValue()); |
755 |
} |
731 |
} |
756 |
break; |
732 |
break; |
757 |
case T_float : |
733 |
case T_float : |
758 |
switch (rightId){ |
734 |
switch (rightId){ |
759 |
case T_char : return BooleanConstant.fromValue(left.floatValue() < right.charValue()); |
735 |
case T_char : return BooleanConstant.fromValue(left.floatValue() < right.charValue()); |
Lines 764-770
Link Here
|
764 |
case T_int: return BooleanConstant.fromValue(left.floatValue() < right.intValue()); |
740 |
case T_int: return BooleanConstant.fromValue(left.floatValue() < right.intValue()); |
765 |
case T_long: return BooleanConstant.fromValue(left.floatValue() < right.longValue()); |
741 |
case T_long: return BooleanConstant.fromValue(left.floatValue() < right.longValue()); |
766 |
} |
742 |
} |
767 |
break; |
743 |
break; |
768 |
case T_double : |
744 |
case T_double : |
769 |
switch (rightId){ |
745 |
switch (rightId){ |
770 |
case T_char : return BooleanConstant.fromValue(left.doubleValue() < right.charValue()); |
746 |
case T_char : return BooleanConstant.fromValue(left.doubleValue() < right.charValue()); |
Lines 775-781
Link Here
|
775 |
case T_int: return BooleanConstant.fromValue(left.doubleValue() < right.intValue()); |
751 |
case T_int: return BooleanConstant.fromValue(left.doubleValue() < right.intValue()); |
776 |
case T_long: return BooleanConstant.fromValue(left.doubleValue() < right.longValue()); |
752 |
case T_long: return BooleanConstant.fromValue(left.doubleValue() < right.longValue()); |
777 |
} |
753 |
} |
778 |
break; |
754 |
break; |
779 |
case T_byte : |
755 |
case T_byte : |
780 |
switch (rightId){ |
756 |
switch (rightId){ |
781 |
case T_char : return BooleanConstant.fromValue(left.byteValue() < right.charValue()); |
757 |
case T_char : return BooleanConstant.fromValue(left.byteValue() < right.charValue()); |
Lines 786-792
Link Here
|
786 |
case T_int: return BooleanConstant.fromValue(left.byteValue() < right.intValue()); |
762 |
case T_int: return BooleanConstant.fromValue(left.byteValue() < right.intValue()); |
787 |
case T_long: return BooleanConstant.fromValue(left.byteValue() < right.longValue()); |
763 |
case T_long: return BooleanConstant.fromValue(left.byteValue() < right.longValue()); |
788 |
} |
764 |
} |
789 |
break; |
765 |
break; |
790 |
case T_short : |
766 |
case T_short : |
791 |
switch (rightId){ |
767 |
switch (rightId){ |
792 |
case T_char : return BooleanConstant.fromValue(left.shortValue() < right.charValue()); |
768 |
case T_char : return BooleanConstant.fromValue(left.shortValue() < right.charValue()); |
Lines 797-803
Link Here
|
797 |
case T_int: return BooleanConstant.fromValue(left.shortValue() < right.intValue()); |
773 |
case T_int: return BooleanConstant.fromValue(left.shortValue() < right.intValue()); |
798 |
case T_long: return BooleanConstant.fromValue(left.shortValue() < right.longValue()); |
774 |
case T_long: return BooleanConstant.fromValue(left.shortValue() < right.longValue()); |
799 |
} |
775 |
} |
800 |
break; |
776 |
break; |
801 |
case T_int : |
777 |
case T_int : |
802 |
switch (rightId){ |
778 |
switch (rightId){ |
803 |
case T_char : return BooleanConstant.fromValue(left.intValue() < right.charValue()); |
779 |
case T_char : return BooleanConstant.fromValue(left.intValue() < right.charValue()); |
Lines 808-814
Link Here
|
808 |
case T_int: return BooleanConstant.fromValue(left.intValue() < right.intValue()); |
784 |
case T_int: return BooleanConstant.fromValue(left.intValue() < right.intValue()); |
809 |
case T_long: return BooleanConstant.fromValue(left.intValue() < right.longValue()); |
785 |
case T_long: return BooleanConstant.fromValue(left.intValue() < right.longValue()); |
810 |
} |
786 |
} |
811 |
break; |
787 |
break; |
812 |
case T_long : |
788 |
case T_long : |
813 |
switch (rightId){ |
789 |
switch (rightId){ |
814 |
case T_char : return BooleanConstant.fromValue(left.longValue() < right.charValue()); |
790 |
case T_char : return BooleanConstant.fromValue(left.longValue() < right.charValue()); |
Lines 819-832
Link Here
|
819 |
case T_int: return BooleanConstant.fromValue(left.longValue() < right.intValue()); |
795 |
case T_int: return BooleanConstant.fromValue(left.longValue() < right.intValue()); |
820 |
case T_long: return BooleanConstant.fromValue(left.longValue() < right.longValue()); |
796 |
case T_long: return BooleanConstant.fromValue(left.longValue() < right.longValue()); |
821 |
} |
797 |
} |
822 |
|
798 |
} |
823 |
} |
|
|
824 |
|
825 |
return NotAConstant; |
799 |
return NotAConstant; |
826 |
} |
800 |
} |
827 |
|
801 |
|
828 |
public static final Constant computeConstantOperationLESS_EQUAL(Constant left, int leftId, Constant right, int rightId) { |
802 |
public static final Constant computeConstantOperationLESS_EQUAL(Constant left, int leftId, Constant right, int rightId) { |
829 |
|
|
|
830 |
switch (leftId){ |
803 |
switch (leftId){ |
831 |
case T_char : |
804 |
case T_char : |
832 |
switch (rightId){ |
805 |
switch (rightId){ |
Lines 838-844
Link Here
|
838 |
case T_int: return BooleanConstant.fromValue(left.charValue() <= right.intValue()); |
811 |
case T_int: return BooleanConstant.fromValue(left.charValue() <= right.intValue()); |
839 |
case T_long: return BooleanConstant.fromValue(left.charValue() <= right.longValue()); |
812 |
case T_long: return BooleanConstant.fromValue(left.charValue() <= right.longValue()); |
840 |
} |
813 |
} |
841 |
break; |
814 |
break; |
842 |
case T_float : |
815 |
case T_float : |
843 |
switch (rightId){ |
816 |
switch (rightId){ |
844 |
case T_char : return BooleanConstant.fromValue(left.floatValue() <= right.charValue()); |
817 |
case T_char : return BooleanConstant.fromValue(left.floatValue() <= right.charValue()); |
Lines 849-855
Link Here
|
849 |
case T_int: return BooleanConstant.fromValue(left.floatValue() <= right.intValue()); |
822 |
case T_int: return BooleanConstant.fromValue(left.floatValue() <= right.intValue()); |
850 |
case T_long: return BooleanConstant.fromValue(left.floatValue() <= right.longValue()); |
823 |
case T_long: return BooleanConstant.fromValue(left.floatValue() <= right.longValue()); |
851 |
} |
824 |
} |
852 |
break; |
825 |
break; |
853 |
case T_double : |
826 |
case T_double : |
854 |
switch (rightId){ |
827 |
switch (rightId){ |
855 |
case T_char : return BooleanConstant.fromValue(left.doubleValue() <= right.charValue()); |
828 |
case T_char : return BooleanConstant.fromValue(left.doubleValue() <= right.charValue()); |
Lines 860-866
Link Here
|
860 |
case T_int: return BooleanConstant.fromValue(left.doubleValue() <= right.intValue()); |
833 |
case T_int: return BooleanConstant.fromValue(left.doubleValue() <= right.intValue()); |
861 |
case T_long: return BooleanConstant.fromValue(left.doubleValue() <= right.longValue()); |
834 |
case T_long: return BooleanConstant.fromValue(left.doubleValue() <= right.longValue()); |
862 |
} |
835 |
} |
863 |
break; |
836 |
break; |
864 |
case T_byte : |
837 |
case T_byte : |
865 |
switch (rightId){ |
838 |
switch (rightId){ |
866 |
case T_char : return BooleanConstant.fromValue(left.byteValue() <= right.charValue()); |
839 |
case T_char : return BooleanConstant.fromValue(left.byteValue() <= right.charValue()); |
Lines 871-877
Link Here
|
871 |
case T_int: return BooleanConstant.fromValue(left.byteValue() <= right.intValue()); |
844 |
case T_int: return BooleanConstant.fromValue(left.byteValue() <= right.intValue()); |
872 |
case T_long: return BooleanConstant.fromValue(left.byteValue() <= right.longValue()); |
845 |
case T_long: return BooleanConstant.fromValue(left.byteValue() <= right.longValue()); |
873 |
} |
846 |
} |
874 |
break; |
847 |
break; |
875 |
case T_short : |
848 |
case T_short : |
876 |
switch (rightId){ |
849 |
switch (rightId){ |
877 |
case T_char : return BooleanConstant.fromValue(left.shortValue() <= right.charValue()); |
850 |
case T_char : return BooleanConstant.fromValue(left.shortValue() <= right.charValue()); |
Lines 893-899
Link Here
|
893 |
case T_int: return BooleanConstant.fromValue(left.intValue() <= right.intValue()); |
866 |
case T_int: return BooleanConstant.fromValue(left.intValue() <= right.intValue()); |
894 |
case T_long: return BooleanConstant.fromValue(left.intValue() <= right.longValue()); |
867 |
case T_long: return BooleanConstant.fromValue(left.intValue() <= right.longValue()); |
895 |
} |
868 |
} |
896 |
break; |
869 |
break; |
897 |
case T_long : |
870 |
case T_long : |
898 |
switch (rightId){ |
871 |
switch (rightId){ |
899 |
case T_char : return BooleanConstant.fromValue(left.longValue() <= right.charValue()); |
872 |
case T_char : return BooleanConstant.fromValue(left.longValue() <= right.charValue()); |
Lines 904-916
Link Here
|
904 |
case T_int: return BooleanConstant.fromValue(left.longValue() <= right.intValue()); |
877 |
case T_int: return BooleanConstant.fromValue(left.longValue() <= right.intValue()); |
905 |
case T_long: return BooleanConstant.fromValue(left.longValue() <= right.longValue()); |
878 |
case T_long: return BooleanConstant.fromValue(left.longValue() <= right.longValue()); |
906 |
} |
879 |
} |
907 |
} |
880 |
} |
908 |
|
|
|
909 |
return NotAConstant; |
881 |
return NotAConstant; |
910 |
} |
882 |
} |
911 |
|
883 |
|
912 |
public static final Constant computeConstantOperationMINUS(Constant left, int leftId, Constant right, int rightId) { |
884 |
public static final Constant computeConstantOperationMINUS(Constant left, int leftId, Constant right, int rightId) { |
913 |
|
|
|
914 |
switch (leftId){ |
885 |
switch (leftId){ |
915 |
case T_char : |
886 |
case T_char : |
916 |
switch (rightId){ |
887 |
switch (rightId){ |
Lines 922-928
Link Here
|
922 |
case T_int: return IntConstant.fromValue(left.charValue() - right.intValue()); |
893 |
case T_int: return IntConstant.fromValue(left.charValue() - right.intValue()); |
923 |
case T_long: return LongConstant.fromValue(left.charValue() - right.longValue()); |
894 |
case T_long: return LongConstant.fromValue(left.charValue() - right.longValue()); |
924 |
} |
895 |
} |
925 |
break; |
896 |
break; |
926 |
case T_float : |
897 |
case T_float : |
927 |
switch (rightId){ |
898 |
switch (rightId){ |
928 |
case T_char : return FloatConstant.fromValue(left.floatValue() - right.charValue()); |
899 |
case T_char : return FloatConstant.fromValue(left.floatValue() - right.charValue()); |
Lines 933-939
Link Here
|
933 |
case T_int: return FloatConstant.fromValue(left.floatValue() - right.intValue()); |
904 |
case T_int: return FloatConstant.fromValue(left.floatValue() - right.intValue()); |
934 |
case T_long: return FloatConstant.fromValue(left.floatValue() - right.longValue()); |
905 |
case T_long: return FloatConstant.fromValue(left.floatValue() - right.longValue()); |
935 |
} |
906 |
} |
936 |
break; |
907 |
break; |
937 |
case T_double : |
908 |
case T_double : |
938 |
switch (rightId){ |
909 |
switch (rightId){ |
939 |
case T_char : return DoubleConstant.fromValue(left.doubleValue() - right.charValue()); |
910 |
case T_char : return DoubleConstant.fromValue(left.doubleValue() - right.charValue()); |
Lines 944-950
Link Here
|
944 |
case T_int: return DoubleConstant.fromValue(left.doubleValue() - right.intValue()); |
915 |
case T_int: return DoubleConstant.fromValue(left.doubleValue() - right.intValue()); |
945 |
case T_long: return DoubleConstant.fromValue(left.doubleValue() - right.longValue()); |
916 |
case T_long: return DoubleConstant.fromValue(left.doubleValue() - right.longValue()); |
946 |
} |
917 |
} |
947 |
break; |
918 |
break; |
948 |
case T_byte : |
919 |
case T_byte : |
949 |
switch (rightId){ |
920 |
switch (rightId){ |
950 |
case T_char : return IntConstant.fromValue(left.byteValue() - right.charValue()); |
921 |
case T_char : return IntConstant.fromValue(left.byteValue() - right.charValue()); |
Lines 955-961
Link Here
|
955 |
case T_int: return IntConstant.fromValue(left.byteValue() - right.intValue()); |
926 |
case T_int: return IntConstant.fromValue(left.byteValue() - right.intValue()); |
956 |
case T_long: return LongConstant.fromValue(left.byteValue() - right.longValue()); |
927 |
case T_long: return LongConstant.fromValue(left.byteValue() - right.longValue()); |
957 |
} |
928 |
} |
958 |
break; |
929 |
break; |
959 |
case T_short : |
930 |
case T_short : |
960 |
switch (rightId){ |
931 |
switch (rightId){ |
961 |
case T_char : return IntConstant.fromValue(left.shortValue() - right.charValue()); |
932 |
case T_char : return IntConstant.fromValue(left.shortValue() - right.charValue()); |
Lines 966-972
Link Here
|
966 |
case T_int: return IntConstant.fromValue(left.shortValue() - right.intValue()); |
937 |
case T_int: return IntConstant.fromValue(left.shortValue() - right.intValue()); |
967 |
case T_long: return LongConstant.fromValue(left.shortValue() - right.longValue()); |
938 |
case T_long: return LongConstant.fromValue(left.shortValue() - right.longValue()); |
968 |
} |
939 |
} |
969 |
break; |
940 |
break; |
970 |
case T_int : |
941 |
case T_int : |
971 |
switch (rightId){ |
942 |
switch (rightId){ |
972 |
case T_char : return IntConstant.fromValue(left.intValue() - right.charValue()); |
943 |
case T_char : return IntConstant.fromValue(left.intValue() - right.charValue()); |
Lines 977-983
Link Here
|
977 |
case T_int: return IntConstant.fromValue(left.intValue() - right.intValue()); |
948 |
case T_int: return IntConstant.fromValue(left.intValue() - right.intValue()); |
978 |
case T_long: return LongConstant.fromValue(left.intValue() - right.longValue()); |
949 |
case T_long: return LongConstant.fromValue(left.intValue() - right.longValue()); |
979 |
} |
950 |
} |
980 |
break; |
951 |
break; |
981 |
case T_long : |
952 |
case T_long : |
982 |
switch (rightId){ |
953 |
switch (rightId){ |
983 |
case T_char : return LongConstant.fromValue(left.longValue() - right.charValue()); |
954 |
case T_char : return LongConstant.fromValue(left.longValue() - right.charValue()); |
Lines 988-1001
Link Here
|
988 |
case T_int: return LongConstant.fromValue(left.longValue() - right.intValue()); |
959 |
case T_int: return LongConstant.fromValue(left.longValue() - right.intValue()); |
989 |
case T_long: return LongConstant.fromValue(left.longValue() - right.longValue()); |
960 |
case T_long: return LongConstant.fromValue(left.longValue() - right.longValue()); |
990 |
} |
961 |
} |
991 |
|
962 |
} |
992 |
} |
|
|
993 |
|
994 |
return NotAConstant; |
963 |
return NotAConstant; |
995 |
} |
964 |
} |
996 |
|
965 |
|
997 |
public static final Constant computeConstantOperationMULTIPLY(Constant left, int leftId, Constant right, int rightId) { |
966 |
public static final Constant computeConstantOperationMULTIPLY(Constant left, int leftId, Constant right, int rightId) { |
998 |
|
|
|
999 |
switch (leftId){ |
967 |
switch (leftId){ |
1000 |
case T_char : |
968 |
case T_char : |
1001 |
switch (rightId){ |
969 |
switch (rightId){ |
Lines 1007-1013
Link Here
|
1007 |
case T_int: return IntConstant.fromValue(left.charValue() * right.intValue()); |
975 |
case T_int: return IntConstant.fromValue(left.charValue() * right.intValue()); |
1008 |
case T_long: return LongConstant.fromValue(left.charValue() * right.longValue()); |
976 |
case T_long: return LongConstant.fromValue(left.charValue() * right.longValue()); |
1009 |
} |
977 |
} |
1010 |
break; |
978 |
break; |
1011 |
case T_float : |
979 |
case T_float : |
1012 |
switch (rightId){ |
980 |
switch (rightId){ |
1013 |
case T_char : return FloatConstant.fromValue(left.floatValue() * right.charValue()); |
981 |
case T_char : return FloatConstant.fromValue(left.floatValue() * right.charValue()); |
Lines 1018-1024
Link Here
|
1018 |
case T_int: return FloatConstant.fromValue(left.floatValue() * right.intValue()); |
986 |
case T_int: return FloatConstant.fromValue(left.floatValue() * right.intValue()); |
1019 |
case T_long: return FloatConstant.fromValue(left.floatValue() * right.longValue()); |
987 |
case T_long: return FloatConstant.fromValue(left.floatValue() * right.longValue()); |
1020 |
} |
988 |
} |
1021 |
break; |
989 |
break; |
1022 |
case T_double : |
990 |
case T_double : |
1023 |
switch (rightId){ |
991 |
switch (rightId){ |
1024 |
case T_char : return DoubleConstant.fromValue(left.doubleValue() * right.charValue()); |
992 |
case T_char : return DoubleConstant.fromValue(left.doubleValue() * right.charValue()); |
Lines 1029-1035
Link Here
|
1029 |
case T_int: return DoubleConstant.fromValue(left.doubleValue() * right.intValue()); |
997 |
case T_int: return DoubleConstant.fromValue(left.doubleValue() * right.intValue()); |
1030 |
case T_long: return DoubleConstant.fromValue(left.doubleValue() * right.longValue()); |
998 |
case T_long: return DoubleConstant.fromValue(left.doubleValue() * right.longValue()); |
1031 |
} |
999 |
} |
1032 |
break; |
1000 |
break; |
1033 |
case T_byte : |
1001 |
case T_byte : |
1034 |
switch (rightId){ |
1002 |
switch (rightId){ |
1035 |
case T_char : return IntConstant.fromValue(left.byteValue() * right.charValue()); |
1003 |
case T_char : return IntConstant.fromValue(left.byteValue() * right.charValue()); |
Lines 1040-1046
Link Here
|
1040 |
case T_int: return IntConstant.fromValue(left.byteValue() * right.intValue()); |
1008 |
case T_int: return IntConstant.fromValue(left.byteValue() * right.intValue()); |
1041 |
case T_long: return LongConstant.fromValue(left.byteValue() * right.longValue()); |
1009 |
case T_long: return LongConstant.fromValue(left.byteValue() * right.longValue()); |
1042 |
} |
1010 |
} |
1043 |
break; |
1011 |
break; |
1044 |
case T_short : |
1012 |
case T_short : |
1045 |
switch (rightId){ |
1013 |
switch (rightId){ |
1046 |
case T_char : return IntConstant.fromValue(left.shortValue() * right.charValue()); |
1014 |
case T_char : return IntConstant.fromValue(left.shortValue() * right.charValue()); |
Lines 1051-1057
Link Here
|
1051 |
case T_int: return IntConstant.fromValue(left.shortValue() * right.intValue()); |
1019 |
case T_int: return IntConstant.fromValue(left.shortValue() * right.intValue()); |
1052 |
case T_long: return LongConstant.fromValue(left.shortValue() * right.longValue()); |
1020 |
case T_long: return LongConstant.fromValue(left.shortValue() * right.longValue()); |
1053 |
} |
1021 |
} |
1054 |
break; |
1022 |
break; |
1055 |
case T_int : |
1023 |
case T_int : |
1056 |
switch (rightId){ |
1024 |
switch (rightId){ |
1057 |
case T_char : return IntConstant.fromValue(left.intValue() * right.charValue()); |
1025 |
case T_char : return IntConstant.fromValue(left.intValue() * right.charValue()); |
Lines 1062-1068
Link Here
|
1062 |
case T_int: return IntConstant.fromValue(left.intValue() * right.intValue()); |
1030 |
case T_int: return IntConstant.fromValue(left.intValue() * right.intValue()); |
1063 |
case T_long: return LongConstant.fromValue(left.intValue() * right.longValue()); |
1031 |
case T_long: return LongConstant.fromValue(left.intValue() * right.longValue()); |
1064 |
} |
1032 |
} |
1065 |
break; |
1033 |
break; |
1066 |
case T_long : |
1034 |
case T_long : |
1067 |
switch (rightId){ |
1035 |
switch (rightId){ |
1068 |
case T_char : return LongConstant.fromValue(left.longValue() * right.charValue()); |
1036 |
case T_char : return LongConstant.fromValue(left.longValue() * right.charValue()); |
Lines 1073-1085
Link Here
|
1073 |
case T_int: return LongConstant.fromValue(left.longValue() * right.intValue()); |
1041 |
case T_int: return LongConstant.fromValue(left.longValue() * right.intValue()); |
1074 |
case T_long: return LongConstant.fromValue(left.longValue() * right.longValue()); |
1042 |
case T_long: return LongConstant.fromValue(left.longValue() * right.longValue()); |
1075 |
} |
1043 |
} |
1076 |
} |
1044 |
} |
1077 |
|
|
|
1078 |
return NotAConstant; |
1045 |
return NotAConstant; |
1079 |
} |
1046 |
} |
1080 |
|
1047 |
|
1081 |
public static final Constant computeConstantOperationOR(Constant left, int leftId, Constant right, int rightId) { |
1048 |
public static final Constant computeConstantOperationOR(Constant left, int leftId, Constant right, int rightId) { |
1082 |
|
|
|
1083 |
switch (leftId){ |
1049 |
switch (leftId){ |
1084 |
case T_boolean : return BooleanConstant.fromValue(left.booleanValue() | right.booleanValue()); |
1050 |
case T_boolean : return BooleanConstant.fromValue(left.booleanValue() | right.booleanValue()); |
1085 |
case T_char : |
1051 |
case T_char : |
Lines 1090-1096
Link Here
|
1090 |
case T_int: return IntConstant.fromValue(left.charValue() | right.intValue()); |
1056 |
case T_int: return IntConstant.fromValue(left.charValue() | right.intValue()); |
1091 |
case T_long: return LongConstant.fromValue(left.charValue() | right.longValue()); |
1057 |
case T_long: return LongConstant.fromValue(left.charValue() | right.longValue()); |
1092 |
} |
1058 |
} |
1093 |
break; |
1059 |
break; |
1094 |
case T_byte : |
1060 |
case T_byte : |
1095 |
switch (rightId){ |
1061 |
switch (rightId){ |
1096 |
case T_char : return IntConstant.fromValue(left.byteValue() | right.charValue()); |
1062 |
case T_char : return IntConstant.fromValue(left.byteValue() | right.charValue()); |
Lines 1099-1105
Link Here
|
1099 |
case T_int: return IntConstant.fromValue(left.byteValue() | right.intValue()); |
1065 |
case T_int: return IntConstant.fromValue(left.byteValue() | right.intValue()); |
1100 |
case T_long: return LongConstant.fromValue(left.byteValue() | right.longValue()); |
1066 |
case T_long: return LongConstant.fromValue(left.byteValue() | right.longValue()); |
1101 |
} |
1067 |
} |
1102 |
break; |
1068 |
break; |
1103 |
case T_short : |
1069 |
case T_short : |
1104 |
switch (rightId){ |
1070 |
switch (rightId){ |
1105 |
case T_char : return IntConstant.fromValue(left.shortValue() | right.charValue()); |
1071 |
case T_char : return IntConstant.fromValue(left.shortValue() | right.charValue()); |
Lines 1108-1114
Link Here
|
1108 |
case T_int: return IntConstant.fromValue(left.shortValue() | right.intValue()); |
1074 |
case T_int: return IntConstant.fromValue(left.shortValue() | right.intValue()); |
1109 |
case T_long: return LongConstant.fromValue(left.shortValue() | right.longValue()); |
1075 |
case T_long: return LongConstant.fromValue(left.shortValue() | right.longValue()); |
1110 |
} |
1076 |
} |
1111 |
break; |
1077 |
break; |
1112 |
case T_int : |
1078 |
case T_int : |
1113 |
switch (rightId){ |
1079 |
switch (rightId){ |
1114 |
case T_char : return IntConstant.fromValue(left.intValue() | right.charValue()); |
1080 |
case T_char : return IntConstant.fromValue(left.intValue() | right.charValue()); |
Lines 1117-1123
Link Here
|
1117 |
case T_int: return IntConstant.fromValue(left.intValue() | right.intValue()); |
1083 |
case T_int: return IntConstant.fromValue(left.intValue() | right.intValue()); |
1118 |
case T_long: return LongConstant.fromValue(left.intValue() | right.longValue()); |
1084 |
case T_long: return LongConstant.fromValue(left.intValue() | right.longValue()); |
1119 |
} |
1085 |
} |
1120 |
break; |
1086 |
break; |
1121 |
case T_long : |
1087 |
case T_long : |
1122 |
switch (rightId){ |
1088 |
switch (rightId){ |
1123 |
case T_char : return LongConstant.fromValue(left.longValue() | right.charValue()); |
1089 |
case T_char : return LongConstant.fromValue(left.longValue() | right.charValue()); |
Lines 1126-1144
Link Here
|
1126 |
case T_int: return LongConstant.fromValue(left.longValue() | right.intValue()); |
1092 |
case T_int: return LongConstant.fromValue(left.longValue() | right.intValue()); |
1127 |
case T_long: return LongConstant.fromValue(left.longValue() | right.longValue()); |
1093 |
case T_long: return LongConstant.fromValue(left.longValue() | right.longValue()); |
1128 |
} |
1094 |
} |
1129 |
|
1095 |
} |
1130 |
} |
|
|
1131 |
|
1132 |
return NotAConstant; |
1096 |
return NotAConstant; |
1133 |
} |
1097 |
} |
1134 |
|
1098 |
|
1135 |
public static final Constant computeConstantOperationOR_OR(Constant left, int leftId, Constant right, int rightId) { |
1099 |
public static final Constant computeConstantOperationOR_OR(Constant left, int leftId, Constant right, int rightId) { |
1136 |
|
|
|
1137 |
return BooleanConstant.fromValue(left.booleanValue() || right.booleanValue()); |
1100 |
return BooleanConstant.fromValue(left.booleanValue() || right.booleanValue()); |
1138 |
} |
1101 |
} |
1139 |
|
1102 |
|
1140 |
public static final Constant computeConstantOperationPLUS(Constant left, int leftId, Constant right, int rightId) { |
1103 |
public static final Constant computeConstantOperationPLUS(Constant left, int leftId, Constant right, int rightId) { |
1141 |
|
|
|
1142 |
switch (leftId){ |
1104 |
switch (leftId){ |
1143 |
case T_JavaLangObject : |
1105 |
case T_JavaLangObject : |
1144 |
if (rightId == T_JavaLangString) { |
1106 |
if (rightId == T_JavaLangString) { |
Lines 1259-1271
Link Here
|
1259 |
// case T_JavaLangString: return Constant.fromValue(left.stringValue() + right.stringValue()); |
1221 |
// case T_JavaLangString: return Constant.fromValue(left.stringValue() + right.stringValue()); |
1260 |
// case T_boolean: return Constant.fromValue(left.stringValue() + right.booleanValue()); |
1222 |
// case T_boolean: return Constant.fromValue(left.stringValue() + right.booleanValue()); |
1261 |
// } |
1223 |
// } |
1262 |
} |
1224 |
} |
1263 |
|
|
|
1264 |
return NotAConstant; |
1225 |
return NotAConstant; |
1265 |
} |
1226 |
} |
1266 |
|
1227 |
|
1267 |
public static final Constant computeConstantOperationREMAINDER(Constant left, int leftId, Constant right, int rightId) { |
1228 |
public static final Constant computeConstantOperationREMAINDER(Constant left, int leftId, Constant right, int rightId) { |
1268 |
|
|
|
1269 |
switch (leftId){ |
1229 |
switch (leftId){ |
1270 |
case T_char : |
1230 |
case T_char : |
1271 |
switch (rightId){ |
1231 |
switch (rightId){ |
Lines 1277-1283
Link Here
|
1277 |
case T_int: return IntConstant.fromValue(left.charValue() % right.intValue()); |
1237 |
case T_int: return IntConstant.fromValue(left.charValue() % right.intValue()); |
1278 |
case T_long: return LongConstant.fromValue(left.charValue() % right.longValue()); |
1238 |
case T_long: return LongConstant.fromValue(left.charValue() % right.longValue()); |
1279 |
} |
1239 |
} |
1280 |
break; |
1240 |
break; |
1281 |
case T_float : |
1241 |
case T_float : |
1282 |
switch (rightId){ |
1242 |
switch (rightId){ |
1283 |
case T_char : return FloatConstant.fromValue(left.floatValue() % right.charValue()); |
1243 |
case T_char : return FloatConstant.fromValue(left.floatValue() % right.charValue()); |
Lines 1288-1294
Link Here
|
1288 |
case T_int: return FloatConstant.fromValue(left.floatValue() % right.intValue()); |
1248 |
case T_int: return FloatConstant.fromValue(left.floatValue() % right.intValue()); |
1289 |
case T_long: return FloatConstant.fromValue(left.floatValue() % right.longValue()); |
1249 |
case T_long: return FloatConstant.fromValue(left.floatValue() % right.longValue()); |
1290 |
} |
1250 |
} |
1291 |
break; |
1251 |
break; |
1292 |
case T_double : |
1252 |
case T_double : |
1293 |
switch (rightId){ |
1253 |
switch (rightId){ |
1294 |
case T_char : return DoubleConstant.fromValue(left.doubleValue() % right.charValue()); |
1254 |
case T_char : return DoubleConstant.fromValue(left.doubleValue() % right.charValue()); |
Lines 1299-1305
Link Here
|
1299 |
case T_int: return DoubleConstant.fromValue(left.doubleValue() % right.intValue()); |
1259 |
case T_int: return DoubleConstant.fromValue(left.doubleValue() % right.intValue()); |
1300 |
case T_long: return DoubleConstant.fromValue(left.doubleValue() % right.longValue()); |
1260 |
case T_long: return DoubleConstant.fromValue(left.doubleValue() % right.longValue()); |
1301 |
} |
1261 |
} |
1302 |
break; |
1262 |
break; |
1303 |
case T_byte : |
1263 |
case T_byte : |
1304 |
switch (rightId){ |
1264 |
switch (rightId){ |
1305 |
case T_char : return IntConstant.fromValue(left.byteValue() % right.charValue()); |
1265 |
case T_char : return IntConstant.fromValue(left.byteValue() % right.charValue()); |
Lines 1310-1316
Link Here
|
1310 |
case T_int: return IntConstant.fromValue(left.byteValue() % right.intValue()); |
1270 |
case T_int: return IntConstant.fromValue(left.byteValue() % right.intValue()); |
1311 |
case T_long: return LongConstant.fromValue(left.byteValue() % right.longValue()); |
1271 |
case T_long: return LongConstant.fromValue(left.byteValue() % right.longValue()); |
1312 |
} |
1272 |
} |
1313 |
break; |
1273 |
break; |
1314 |
case T_short : |
1274 |
case T_short : |
1315 |
switch (rightId){ |
1275 |
switch (rightId){ |
1316 |
case T_char : return IntConstant.fromValue(left.shortValue() % right.charValue()); |
1276 |
case T_char : return IntConstant.fromValue(left.shortValue() % right.charValue()); |
Lines 1321-1327
Link Here
|
1321 |
case T_int: return IntConstant.fromValue(left.shortValue() % right.intValue()); |
1281 |
case T_int: return IntConstant.fromValue(left.shortValue() % right.intValue()); |
1322 |
case T_long: return LongConstant.fromValue(left.shortValue() % right.longValue()); |
1282 |
case T_long: return LongConstant.fromValue(left.shortValue() % right.longValue()); |
1323 |
} |
1283 |
} |
1324 |
break; |
1284 |
break; |
1325 |
case T_int : |
1285 |
case T_int : |
1326 |
switch (rightId){ |
1286 |
switch (rightId){ |
1327 |
case T_char : return IntConstant.fromValue(left.intValue() % right.charValue()); |
1287 |
case T_char : return IntConstant.fromValue(left.intValue() % right.charValue()); |
Lines 1332-1338
Link Here
|
1332 |
case T_int: return IntConstant.fromValue(left.intValue() % right.intValue()); |
1292 |
case T_int: return IntConstant.fromValue(left.intValue() % right.intValue()); |
1333 |
case T_long: return LongConstant.fromValue(left.intValue() % right.longValue()); |
1293 |
case T_long: return LongConstant.fromValue(left.intValue() % right.longValue()); |
1334 |
} |
1294 |
} |
1335 |
break; |
1295 |
break; |
1336 |
case T_long : |
1296 |
case T_long : |
1337 |
switch (rightId){ |
1297 |
switch (rightId){ |
1338 |
case T_char : return LongConstant.fromValue(left.longValue() % right.charValue()); |
1298 |
case T_char : return LongConstant.fromValue(left.longValue() % right.charValue()); |
Lines 1343-1356
Link Here
|
1343 |
case T_int: return LongConstant.fromValue(left.longValue() % right.intValue()); |
1303 |
case T_int: return LongConstant.fromValue(left.longValue() % right.intValue()); |
1344 |
case T_long: return LongConstant.fromValue(left.longValue() % right.longValue()); |
1304 |
case T_long: return LongConstant.fromValue(left.longValue() % right.longValue()); |
1345 |
} |
1305 |
} |
1346 |
|
1306 |
} |
1347 |
} |
|
|
1348 |
|
1349 |
return NotAConstant; |
1307 |
return NotAConstant; |
1350 |
} |
1308 |
} |
1351 |
|
1309 |
|
1352 |
public static final Constant computeConstantOperationRIGHT_SHIFT(Constant left, int leftId, Constant right, int rightId) { |
1310 |
public static final Constant computeConstantOperationRIGHT_SHIFT(Constant left, int leftId, Constant right, int rightId) { |
1353 |
|
|
|
1354 |
switch (leftId){ |
1311 |
switch (leftId){ |
1355 |
case T_char : |
1312 |
case T_char : |
1356 |
switch (rightId){ |
1313 |
switch (rightId){ |
Lines 1360-1366
Link Here
|
1360 |
case T_int: return IntConstant.fromValue(left.charValue() >> right.intValue()); |
1317 |
case T_int: return IntConstant.fromValue(left.charValue() >> right.intValue()); |
1361 |
case T_long: return IntConstant.fromValue(left.charValue() >> right.longValue()); |
1318 |
case T_long: return IntConstant.fromValue(left.charValue() >> right.longValue()); |
1362 |
} |
1319 |
} |
1363 |
break; |
1320 |
break; |
1364 |
case T_byte : |
1321 |
case T_byte : |
1365 |
switch (rightId){ |
1322 |
switch (rightId){ |
1366 |
case T_char : return IntConstant.fromValue(left.byteValue() >> right.charValue()); |
1323 |
case T_char : return IntConstant.fromValue(left.byteValue() >> right.charValue()); |
Lines 1369-1375
Link Here
|
1369 |
case T_int: return IntConstant.fromValue(left.byteValue() >> right.intValue()); |
1326 |
case T_int: return IntConstant.fromValue(left.byteValue() >> right.intValue()); |
1370 |
case T_long: return IntConstant.fromValue(left.byteValue() >> right.longValue()); |
1327 |
case T_long: return IntConstant.fromValue(left.byteValue() >> right.longValue()); |
1371 |
} |
1328 |
} |
1372 |
break; |
1329 |
break; |
1373 |
case T_short : |
1330 |
case T_short : |
1374 |
switch (rightId){ |
1331 |
switch (rightId){ |
1375 |
case T_char : return IntConstant.fromValue(left.shortValue() >> right.charValue()); |
1332 |
case T_char : return IntConstant.fromValue(left.shortValue() >> right.charValue()); |
Lines 1378-1384
Link Here
|
1378 |
case T_int: return IntConstant.fromValue(left.shortValue() >> right.intValue()); |
1335 |
case T_int: return IntConstant.fromValue(left.shortValue() >> right.intValue()); |
1379 |
case T_long: return IntConstant.fromValue(left.shortValue() >> right.longValue()); |
1336 |
case T_long: return IntConstant.fromValue(left.shortValue() >> right.longValue()); |
1380 |
} |
1337 |
} |
1381 |
break; |
1338 |
break; |
1382 |
case T_int : |
1339 |
case T_int : |
1383 |
switch (rightId){ |
1340 |
switch (rightId){ |
1384 |
case T_char : return IntConstant.fromValue(left.intValue() >> right.charValue()); |
1341 |
case T_char : return IntConstant.fromValue(left.intValue() >> right.charValue()); |
Lines 1387-1393
Link Here
|
1387 |
case T_int: return IntConstant.fromValue(left.intValue() >> right.intValue()); |
1344 |
case T_int: return IntConstant.fromValue(left.intValue() >> right.intValue()); |
1388 |
case T_long: return IntConstant.fromValue(left.intValue() >> right.longValue()); |
1345 |
case T_long: return IntConstant.fromValue(left.intValue() >> right.longValue()); |
1389 |
} |
1346 |
} |
1390 |
break; |
1347 |
break; |
1391 |
case T_long : |
1348 |
case T_long : |
1392 |
switch (rightId){ |
1349 |
switch (rightId){ |
1393 |
case T_char : return LongConstant.fromValue(left.longValue() >> right.charValue()); |
1350 |
case T_char : return LongConstant.fromValue(left.longValue() >> right.charValue()); |
Lines 1396-1409
Link Here
|
1396 |
case T_int: return LongConstant.fromValue(left.longValue() >> right.intValue()); |
1353 |
case T_int: return LongConstant.fromValue(left.longValue() >> right.intValue()); |
1397 |
case T_long: return LongConstant.fromValue(left.longValue() >> right.longValue()); |
1354 |
case T_long: return LongConstant.fromValue(left.longValue() >> right.longValue()); |
1398 |
} |
1355 |
} |
1399 |
|
1356 |
} |
1400 |
} |
|
|
1401 |
|
1402 |
return NotAConstant; |
1357 |
return NotAConstant; |
1403 |
} |
1358 |
} |
1404 |
|
1359 |
|
1405 |
public static final Constant computeConstantOperationUNSIGNED_RIGHT_SHIFT(Constant left, int leftId, Constant right, int rightId) { |
1360 |
public static final Constant computeConstantOperationUNSIGNED_RIGHT_SHIFT(Constant left, int leftId, Constant right, int rightId) { |
1406 |
|
|
|
1407 |
switch (leftId){ |
1361 |
switch (leftId){ |
1408 |
case T_char : |
1362 |
case T_char : |
1409 |
switch (rightId){ |
1363 |
switch (rightId){ |
Lines 1413-1419
Link Here
|
1413 |
case T_int: return IntConstant.fromValue(left.charValue() >>> right.intValue()); |
1367 |
case T_int: return IntConstant.fromValue(left.charValue() >>> right.intValue()); |
1414 |
case T_long: return IntConstant.fromValue(left.charValue() >>> right.longValue()); |
1368 |
case T_long: return IntConstant.fromValue(left.charValue() >>> right.longValue()); |
1415 |
} |
1369 |
} |
1416 |
break; |
1370 |
break; |
1417 |
case T_byte : |
1371 |
case T_byte : |
1418 |
switch (rightId){ |
1372 |
switch (rightId){ |
1419 |
case T_char : return IntConstant.fromValue(left.byteValue() >>> right.charValue()); |
1373 |
case T_char : return IntConstant.fromValue(left.byteValue() >>> right.charValue()); |
Lines 1422-1428
Link Here
|
1422 |
case T_int: return IntConstant.fromValue(left.byteValue() >>> right.intValue()); |
1376 |
case T_int: return IntConstant.fromValue(left.byteValue() >>> right.intValue()); |
1423 |
case T_long: return IntConstant.fromValue(left.byteValue() >>> right.longValue()); |
1377 |
case T_long: return IntConstant.fromValue(left.byteValue() >>> right.longValue()); |
1424 |
} |
1378 |
} |
1425 |
break; |
1379 |
break; |
1426 |
case T_short : |
1380 |
case T_short : |
1427 |
switch (rightId){ |
1381 |
switch (rightId){ |
1428 |
case T_char : return IntConstant.fromValue(left.shortValue() >>> right.charValue()); |
1382 |
case T_char : return IntConstant.fromValue(left.shortValue() >>> right.charValue()); |
Lines 1431-1437
Link Here
|
1431 |
case T_int: return IntConstant.fromValue(left.shortValue() >>> right.intValue()); |
1385 |
case T_int: return IntConstant.fromValue(left.shortValue() >>> right.intValue()); |
1432 |
case T_long: return IntConstant.fromValue(left.shortValue() >>> right.longValue()); |
1386 |
case T_long: return IntConstant.fromValue(left.shortValue() >>> right.longValue()); |
1433 |
} |
1387 |
} |
1434 |
break; |
1388 |
break; |
1435 |
case T_int : |
1389 |
case T_int : |
1436 |
switch (rightId){ |
1390 |
switch (rightId){ |
1437 |
case T_char : return IntConstant.fromValue(left.intValue() >>> right.charValue()); |
1391 |
case T_char : return IntConstant.fromValue(left.intValue() >>> right.charValue()); |
Lines 1440-1446
Link Here
|
1440 |
case T_int: return IntConstant.fromValue(left.intValue() >>> right.intValue()); |
1394 |
case T_int: return IntConstant.fromValue(left.intValue() >>> right.intValue()); |
1441 |
case T_long: return IntConstant.fromValue(left.intValue() >>> right.longValue()); |
1395 |
case T_long: return IntConstant.fromValue(left.intValue() >>> right.longValue()); |
1442 |
} |
1396 |
} |
1443 |
break; |
1397 |
break; |
1444 |
case T_long : |
1398 |
case T_long : |
1445 |
switch (rightId){ |
1399 |
switch (rightId){ |
1446 |
case T_char : return LongConstant.fromValue(left.longValue() >>> right.charValue()); |
1400 |
case T_char : return LongConstant.fromValue(left.longValue() >>> right.charValue()); |
Lines 1449-1462
Link Here
|
1449 |
case T_int: return LongConstant.fromValue(left.longValue() >>> right.intValue()); |
1403 |
case T_int: return LongConstant.fromValue(left.longValue() >>> right.intValue()); |
1450 |
case T_long: return LongConstant.fromValue(left.longValue() >>> right.longValue()); |
1404 |
case T_long: return LongConstant.fromValue(left.longValue() >>> right.longValue()); |
1451 |
} |
1405 |
} |
1452 |
|
1406 |
} |
1453 |
} |
|
|
1454 |
|
1455 |
return NotAConstant; |
1407 |
return NotAConstant; |
1456 |
} |
1408 |
} |
1457 |
|
1409 |
|
1458 |
public static final Constant computeConstantOperationXOR(Constant left, int leftId, Constant right, int rightId) { |
1410 |
public static final Constant computeConstantOperationXOR(Constant left, int leftId, Constant right, int rightId) { |
1459 |
|
|
|
1460 |
switch (leftId){ |
1411 |
switch (leftId){ |
1461 |
case T_boolean : return BooleanConstant.fromValue(left.booleanValue() ^ right.booleanValue()); |
1412 |
case T_boolean : return BooleanConstant.fromValue(left.booleanValue() ^ right.booleanValue()); |
1462 |
case T_char : |
1413 |
case T_char : |
Lines 1467-1473
Link Here
|
1467 |
case T_int: return IntConstant.fromValue(left.charValue() ^ right.intValue()); |
1418 |
case T_int: return IntConstant.fromValue(left.charValue() ^ right.intValue()); |
1468 |
case T_long: return LongConstant.fromValue(left.charValue() ^ right.longValue()); |
1419 |
case T_long: return LongConstant.fromValue(left.charValue() ^ right.longValue()); |
1469 |
} |
1420 |
} |
1470 |
break; |
1421 |
break; |
1471 |
case T_byte : |
1422 |
case T_byte : |
1472 |
switch (rightId){ |
1423 |
switch (rightId){ |
1473 |
case T_char : return IntConstant.fromValue(left.byteValue() ^ right.charValue()); |
1424 |
case T_char : return IntConstant.fromValue(left.byteValue() ^ right.charValue()); |
Lines 1476-1482
Link Here
|
1476 |
case T_int: return IntConstant.fromValue(left.byteValue() ^ right.intValue()); |
1427 |
case T_int: return IntConstant.fromValue(left.byteValue() ^ right.intValue()); |
1477 |
case T_long: return LongConstant.fromValue(left.byteValue() ^ right.longValue()); |
1428 |
case T_long: return LongConstant.fromValue(left.byteValue() ^ right.longValue()); |
1478 |
} |
1429 |
} |
1479 |
break; |
1430 |
break; |
1480 |
case T_short : |
1431 |
case T_short : |
1481 |
switch (rightId){ |
1432 |
switch (rightId){ |
1482 |
case T_char : return IntConstant.fromValue(left.shortValue() ^ right.charValue()); |
1433 |
case T_char : return IntConstant.fromValue(left.shortValue() ^ right.charValue()); |
Lines 1485-1491
Link Here
|
1485 |
case T_int: return IntConstant.fromValue(left.shortValue() ^ right.intValue()); |
1436 |
case T_int: return IntConstant.fromValue(left.shortValue() ^ right.intValue()); |
1486 |
case T_long: return LongConstant.fromValue(left.shortValue() ^ right.longValue()); |
1437 |
case T_long: return LongConstant.fromValue(left.shortValue() ^ right.longValue()); |
1487 |
} |
1438 |
} |
1488 |
break; |
1439 |
break; |
1489 |
case T_int : |
1440 |
case T_int : |
1490 |
switch (rightId){ |
1441 |
switch (rightId){ |
1491 |
case T_char : return IntConstant.fromValue(left.intValue() ^ right.charValue()); |
1442 |
case T_char : return IntConstant.fromValue(left.intValue() ^ right.charValue()); |
Lines 1494-1500
Link Here
|
1494 |
case T_int: return IntConstant.fromValue(left.intValue() ^ right.intValue()); |
1445 |
case T_int: return IntConstant.fromValue(left.intValue() ^ right.intValue()); |
1495 |
case T_long: return LongConstant.fromValue(left.intValue() ^ right.longValue()); |
1446 |
case T_long: return LongConstant.fromValue(left.intValue() ^ right.longValue()); |
1496 |
} |
1447 |
} |
1497 |
break; |
1448 |
break; |
1498 |
case T_long : |
1449 |
case T_long : |
1499 |
switch (rightId){ |
1450 |
switch (rightId){ |
1500 |
case T_char : return LongConstant.fromValue(left.longValue() ^ right.charValue()); |
1451 |
case T_char : return LongConstant.fromValue(left.longValue() ^ right.charValue()); |
Lines 1503-1522
Link Here
|
1503 |
case T_int: return LongConstant.fromValue(left.longValue() ^ right.intValue()); |
1454 |
case T_int: return LongConstant.fromValue(left.longValue() ^ right.intValue()); |
1504 |
case T_long: return LongConstant.fromValue(left.longValue() ^ right.longValue()); |
1455 |
case T_long: return LongConstant.fromValue(left.longValue() ^ right.longValue()); |
1505 |
} |
1456 |
} |
1506 |
} |
1457 |
} |
1507 |
|
|
|
1508 |
return NotAConstant; |
1458 |
return NotAConstant; |
1509 |
} |
1459 |
} |
1510 |
|
1460 |
|
1511 |
public double doubleValue() { |
1461 |
public double doubleValue() { |
1512 |
|
|
|
1513 |
throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotCastedInto, new String[] { typeName(), "double" })); //$NON-NLS-1$ |
1462 |
throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotCastedInto, new String[] { typeName(), "double" })); //$NON-NLS-1$ |
1514 |
} |
1463 |
} |
1515 |
|
1464 |
|
1516 |
public float floatValue() { |
1465 |
public float floatValue() { |
1517 |
|
|
|
1518 |
throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotCastedInto, new String[] { typeName(), "float" })); //$NON-NLS-1$ |
1466 |
throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotCastedInto, new String[] { typeName(), "float" })); //$NON-NLS-1$ |
1519 |
} |
1467 |
} |
|
|
1468 |
|
1520 |
/** |
1469 |
/** |
1521 |
* Returns true if both constants have the same type and the same actual value |
1470 |
* Returns true if both constants have the same type and the same actual value |
1522 |
* @param otherConstant |
1471 |
* @param otherConstant |
Lines 1554-1580
Link Here
|
1554 |
} |
1503 |
} |
1555 |
|
1504 |
|
1556 |
public int intValue() { |
1505 |
public int intValue() { |
1557 |
|
|
|
1558 |
throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotCastedInto, new String[] { typeName(), "int" })); //$NON-NLS-1$ |
1506 |
throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotCastedInto, new String[] { typeName(), "int" })); //$NON-NLS-1$ |
1559 |
} |
1507 |
} |
1560 |
|
1508 |
|
1561 |
public long longValue() { |
1509 |
public long longValue() { |
1562 |
|
|
|
1563 |
throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotCastedInto, new String[] { typeName(), "long" })); //$NON-NLS-1$ |
1510 |
throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotCastedInto, new String[] { typeName(), "long" })); //$NON-NLS-1$ |
1564 |
} |
1511 |
} |
1565 |
|
1512 |
|
1566 |
public short shortValue() { |
1513 |
public short shortValue() { |
1567 |
|
|
|
1568 |
throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotConvertedTo, new String[] { typeName(), "short" })); //$NON-NLS-1$ |
1514 |
throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotConvertedTo, new String[] { typeName(), "short" })); //$NON-NLS-1$ |
1569 |
} |
1515 |
} |
1570 |
|
1516 |
|
1571 |
public String stringValue() { |
1517 |
public String stringValue() { |
1572 |
|
|
|
1573 |
throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotConvertedTo, new String[] { typeName(), "String" })); //$NON-NLS-1$ |
1518 |
throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotConvertedTo, new String[] { typeName(), "String" })); //$NON-NLS-1$ |
1574 |
} |
1519 |
} |
1575 |
|
1520 |
|
1576 |
public String toString(){ |
1521 |
public String toString(){ |
1577 |
|
|
|
1578 |
if (this == NotAConstant) return "(Constant) NotAConstant"; //$NON-NLS-1$ |
1522 |
if (this == NotAConstant) return "(Constant) NotAConstant"; //$NON-NLS-1$ |
1579 |
return super.toString(); } |
1523 |
return super.toString(); } |
1580 |
|
1524 |
|