A massive organize imports and formatting of the sources using default Eclipse code...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / impl / Constant.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.impl;
12
13 import net.sourceforge.phpdt.internal.compiler.ast.OperatorIds;
14 import net.sourceforge.phpdt.internal.compiler.lookup.TypeIds;
15 import net.sourceforge.phpdt.internal.compiler.problem.ShouldNotImplement;
16 import net.sourceforge.phpdt.internal.compiler.util.Util;
17
18 public abstract class Constant implements TypeIds, OperatorIds {
19
20         public static final Constant NotAConstant = new DoubleConstant(Double.NaN);
21
22         public static final IntConstant Zero = new IntConstant(0);
23
24         public static final IntConstant Two = new IntConstant(2);
25
26         public static final IntConstant One = new IntConstant(1);
27
28         public boolean booleanValue() {
29
30                 throw new ShouldNotImplement(Util.bind(
31                                 "constant.cannotCastedInto", typeName(), "boolean")); //$NON-NLS-1$ //$NON-NLS-2$
32         }
33
34         public byte byteValue() {
35
36                 throw new ShouldNotImplement(Util.bind(
37                                 "constant.cannotCastedInto", typeName(), "byte")); //$NON-NLS-1$ //$NON-NLS-2$
38         }
39
40         public final Constant castTo(int conversionToTargetType) {
41                 // the cast is an int of the form
42                 // (castId<<4)+typeId (in order to follow the
43                 // user written style (cast)expression ....
44
45                 if (this == NotAConstant)
46                         return NotAConstant;
47                 switch (conversionToTargetType) {
48                 case T_undefined:
49                         return this;
50                         // TARGET TYPE <- FROM TYPE
51                         // case (T_undefined<<4)+T_undefined : return NotAConstant;
52                         // case (T_undefined<<4)+T_byte : return NotAConstant;
53                         // case (T_undefined<<4)+T_long : return NotAConstant;
54                         // case (T_undefined<<4)+T_short : return NotAConstant;
55                         // case (T_undefined<<4)+T_void : return NotAConstant;
56                         // case (T_undefined<<4)+T_String : return NotAConstant;
57                         // case (T_undefined<<4)+T_Object : return NotAConstant;
58                         // case (T_undefined<<4)+T_double : return NotAConstant;
59                         // case (T_undefined<<4)+T_float : return NotAConstant;
60                         // case (T_undefined<<4)+T_boolean : return NotAConstant;
61                         // case (T_undefined<<4)+T_char : return NotAConstant;
62                         // case (T_undefined<<4)+T_int : return NotAConstant;
63
64                         // case (T_byte<<4)+T_undefined : return NotAConstant;
65                 case (T_byte << 4) + T_byte:
66                         return this;
67                 case (T_byte << 4) + T_long:
68                         return Constant.fromValue((byte) this.longValue());
69                 case (T_byte << 4) + T_short:
70                         return Constant.fromValue((byte) this.shortValue());
71                         // case (T_byte<<4)+T_void : return NotAConstant;
72                         // case (T_byte<<4)+T_String : return NotAConstant;
73                         // case (T_byte<<4)+T_Object : return NotAConstant;
74                 case (T_byte << 4) + T_double:
75                         return Constant.fromValue((byte) this.doubleValue());
76                 case (T_byte << 4) + T_float:
77                         return Constant.fromValue((byte) this.floatValue());
78                         // case (T_byte<<4)+T_boolean : return NotAConstant;
79                 case (T_byte << 4) + T_char:
80                         return Constant.fromValue((byte) this.charValue());
81                 case (T_byte << 4) + T_int:
82                         return Constant.fromValue((byte) this.intValue());
83
84                         // case (T_long<<4)+T_undefined : return NotAConstant;
85                 case (T_long << 4) + T_byte:
86                         return Constant.fromValue((long) this.byteValue());
87                 case (T_long << 4) + T_long:
88                         return this;
89                 case (T_long << 4) + T_short:
90                         return Constant.fromValue((long) this.shortValue());
91                         // case (T_long<<4)+T_void : return NotAConstant;
92                         // case (T_long<<4)+T_String : return NotAConstant;
93                         // case (T_long<<4)+T_Object : return NotAConstant;
94                 case (T_long << 4) + T_double:
95                         return Constant.fromValue((long) this.doubleValue());
96                 case (T_long << 4) + T_float:
97                         return Constant.fromValue((long) this.floatValue());
98                         // case (T_long<<4)+T_boolean : return NotAConstant;
99                 case (T_long << 4) + T_char:
100                         return Constant.fromValue((long) this.charValue());
101                 case (T_long << 4) + T_int:
102                         return Constant.fromValue((long) this.intValue());
103
104                         // case (T_short<<4)+T_undefined : return NotAConstant;
105                 case (T_short << 4) + T_byte:
106                         return Constant.fromValue((short) this.byteValue());
107                 case (T_short << 4) + T_long:
108                         return Constant.fromValue((short) this.longValue());
109                 case (T_short << 4) + T_short:
110                         return this;
111                         // case (T_short<<4)+T_void : return NotAConstant;
112                         // case (T_short<<4)+T_String : return NotAConstant;
113                         // case (T_short<<4)+T_Object : return NotAConstant;
114                 case (T_short << 4) + T_double:
115                         return Constant.fromValue((short) this.doubleValue());
116                 case (T_short << 4) + T_float:
117                         return Constant.fromValue((short) this.floatValue());
118                         // case (T_short<<4)+T_boolean : return NotAConstant;
119                 case (T_short << 4) + T_char:
120                         return Constant.fromValue((short) this.charValue());
121                 case (T_short << 4) + T_int:
122                         return Constant.fromValue((short) this.intValue());
123
124                         // case (T_void<<4)+T_undefined : return NotAConstant;
125                         // case (T_void<<4)+T_byte : return NotAConstant;
126                         // case (T_void<<4)+T_long : return NotAConstant;
127                         // case (T_void<<4)+T_short : return NotAConstant;
128                         // case (T_void<<4)+T_void : return NotAConstant;
129                         // case (T_void<<4)+T_String : return NotAConstant;
130                         // case (T_void<<4)+T_Object : return NotAConstant;
131                         // case (T_void<<4)+T_double : return NotAConstant;
132                         // case (T_void<<4)+T_float : return NotAConstant;
133                         // case (T_void<<4)+T_boolean : return NotAConstant;
134                         // case (T_void<<4)+T_char : return NotAConstant;
135                         // case (T_void<<4)+T_int : return NotAConstant;
136
137                         // case (T_String<<4)+T_undefined : return NotAConstant;
138                         // case (T_String<<4)+T_byte : return NotAConstant;
139                         // case (T_String<<4)+T_long : return NotAConstant;
140                         // case (T_String<<4)+T_short : return NotAConstant;
141                         // case (T_String<<4)+T_void : return NotAConstant;
142                 case (T_String << 4) + T_String:
143                         return this;
144                         // case (T_String<<4)+T_Object : return NotAConstant;
145                         // case (T_String<<4)+T_double : return NotAConstant;
146                         // case (T_String<<4)+T_float : return NotAConstant;
147                         // case (T_String<<4)+T_boolean : return NotAConstant;
148                         // case (T_String<<4)+T_char : return NotAConstant;
149                         // case (T_String<<4)+T_int : return NotAConstant;
150
151                         // case (T_Object<<4)+T_undefined : return NotAConstant;
152                         // case (T_Object<<4)+T_byte : return NotAConstant;
153                         // case (T_Object<<4)+T_long : return NotAConstant;
154                         // case (T_Object<<4)+T_short : return NotAConstant;
155                         // case (T_Object<<4)+T_void : return NotAConstant;
156                         // case (T_Object<<4)+T_String : return NotAConstant;
157                         // case (T_Object<<4)+T_Object : return NotAConstant;
158                         // case (T_Object<<4)+T_double : return NotAConstant;
159                         // case (T_Object<<4)+T_float : return NotAConstant;
160                         // case (T_Object<<4)+T_boolean : return NotAConstant;
161                         // case (T_Object<<4)+T_char : return NotAConstant;
162                         // case (T_Object<<4)+T_int : return NotAConstant;
163
164                         // case (T_double<<4)+T_undefined : return NotAConstant;
165                 case (T_double << 4) + T_byte:
166                         return Constant.fromValue((double) this.byteValue());
167                 case (T_double << 4) + T_long:
168                         return Constant.fromValue((double) this.longValue());
169                 case (T_double << 4) + T_short:
170                         return Constant.fromValue((double) this.shortValue());
171                         // case (T_double<<4)+T_void : return NotAConstant;
172                         // case (T_double<<4)+T_String : return NotAConstant;
173                         // case (T_double<<4)+T_Object : return NotAConstant;
174                 case (T_double << 4) + T_double:
175                         return this;
176                 case (T_double << 4) + T_float:
177                         return Constant.fromValue((double) this.floatValue());
178                         // case (T_double<<4)+T_boolean : return NotAConstant;
179                 case (T_double << 4) + T_char:
180                         return Constant.fromValue((double) this.charValue());
181                 case (T_double << 4) + T_int:
182                         return Constant.fromValue((double) this.intValue());
183
184                         // case (T_float<<4)+T_undefined : return NotAConstant;
185                 case (T_float << 4) + T_byte:
186                         return Constant.fromValue((float) this.byteValue());
187                 case (T_float << 4) + T_long:
188                         return Constant.fromValue((float) this.longValue());
189                 case (T_float << 4) + T_short:
190                         return Constant.fromValue((float) this.shortValue());
191                         // case (T_float<<4)+T_void : return NotAConstant;
192                         // case (T_float<<4)+T_String : return NotAConstant;
193                         // case (T_float<<4)+T_Object : return NotAConstant;
194                 case (T_float << 4) + T_double:
195                         return Constant.fromValue((float) this.doubleValue());
196                 case (T_float << 4) + T_float:
197                         return this;
198                         // case (T_float<<4)+T_boolean : return NotAConstant;
199                 case (T_float << 4) + T_char:
200                         return Constant.fromValue((float) this.charValue());
201                 case (T_float << 4) + T_int:
202                         return Constant.fromValue((float) this.intValue());
203
204                         // case (T_boolean<<4)+T_undefined : return NotAConstant;
205                         // case (T_boolean<<4)+T_byte : return NotAConstant;
206                         // case (T_boolean<<4)+T_long : return NotAConstant;
207                         // case (T_boolean<<4)+T_short : return NotAConstant;
208                         // case (T_boolean<<4)+T_void : return NotAConstant;
209                         // case (T_boolean<<4)+T_String : return NotAConstant;
210                         // case (T_boolean<<4)+T_Object : return NotAConstant;
211                         // case (T_boolean<<4)+T_double : return NotAConstant;
212                         // case (T_boolean<<4)+T_float : return NotAConstant;
213                 case (T_boolean << 4) + T_boolean:
214                         return this;
215                         // case (T_boolean<<4)+T_char : return NotAConstant;
216                         // case (T_boolean<<4)+T_int : return NotAConstant;
217
218                         // case (T_char<<4)+T_undefined : return NotAConstant;
219                 case (T_char << 4) + T_byte:
220                         return Constant.fromValue((char) this.byteValue());
221                 case (T_char << 4) + T_long:
222                         return Constant.fromValue((char) this.longValue());
223                 case (T_char << 4) + T_short:
224                         return Constant.fromValue((char) this.shortValue());
225                         // case (T_char<<4)+T_void : return NotAConstant;
226                         // case (T_char<<4)+T_String : return NotAConstant;
227                         // case (T_char<<4)+T_Object : return NotAConstant;
228                 case (T_char << 4) + T_double:
229                         return Constant.fromValue((char) this.doubleValue());
230                 case (T_char << 4) + T_float:
231                         return Constant.fromValue((char) this.floatValue());
232                         // case (T_char<<4)+T_boolean : return NotAConstant;
233                 case (T_char << 4) + T_char:
234                         return this;
235                 case (T_char << 4) + T_int:
236                         return Constant.fromValue((char) this.intValue());
237
238                         // case (T_int<<4)+T_undefined : return NotAConstant;
239                 case (T_int << 4) + T_byte:
240                         return Constant.fromValue((int) this.byteValue());
241                 case (T_int << 4) + T_long:
242                         return Constant.fromValue((int) this.longValue());
243                 case (T_int << 4) + T_short:
244                         return Constant.fromValue((int) this.shortValue());
245                         // case (T_int<<4)+T_void : return NotAConstant;
246                         // case (T_int<<4)+T_String : return NotAConstant;
247                         // case (T_int<<4)+T_Object : return NotAConstant;
248                 case (T_int << 4) + T_double:
249                         return Constant.fromValue((int) this.doubleValue());
250                 case (T_int << 4) + T_float:
251                         return Constant.fromValue((int) this.floatValue());
252                         // case (T_int<<4)+T_boolean : return NotAConstant;
253                 case (T_int << 4) + T_char:
254                         return Constant.fromValue((int) this.charValue());
255                 case (T_int << 4) + T_int:
256                         return this;
257
258                 }
259
260                 return NotAConstant;
261         }
262
263         public char charValue() {
264
265                 throw new ShouldNotImplement(Util.bind(
266                                 "constant.cannotCastedInto", typeName(), "char")); //$NON-NLS-1$ //$NON-NLS-2$
267         }
268
269         public static final Constant computeConstantOperation(Constant cst, int id,
270                         int operator) {
271
272                 switch (operator) {
273                 case NOT:
274                         return Constant.fromValue(!cst.booleanValue());
275                 case PLUS:
276                         return cst;
277                 case MINUS: // the two special -9223372036854775808L and -2147483648 are
278                                         // inlined at parseTime
279                         switch (id) {
280                         case T_float:
281                                 float f;
282                                 if ((f = cst.floatValue()) == 0.0f) { // positive and negative
283                                                                                                                 // 0....
284                                         if (Float.floatToIntBits(f) == 0)
285                                                 return Constant.fromValue(-0.0f);
286                                         else
287                                                 return Constant.fromValue(0.0f);
288                                 }
289                                 break; // default case
290                         case T_double:
291                                 double d;
292                                 if ((d = cst.doubleValue()) == 0.0d) { // positive and negative
293                                                                                                                 // 0....
294                                         if (Double.doubleToLongBits(d) == 0)
295                                                 return Constant.fromValue(-0.0d);
296                                         else
297                                                 return Constant.fromValue(0.0d);
298                                 }
299                                 break; // default case
300                         }
301                         return computeConstantOperationMINUS(Zero, T_int, operator, cst, id);
302                 case TWIDDLE:
303                         switch (id) {
304                         case T_char:
305                                 return Constant.fromValue(~cst.charValue());
306                         case T_byte:
307                                 return Constant.fromValue(~cst.byteValue());
308                         case T_short:
309                                 return Constant.fromValue(~cst.shortValue());
310                         case T_int:
311                                 return Constant.fromValue(~cst.intValue());
312                         case T_long:
313                                 return Constant.fromValue(~cst.longValue());
314                         default:
315                                 return NotAConstant;
316                         }
317                 default:
318                         return NotAConstant;
319                 }
320         }
321
322         public static final Constant computeConstantOperation(Constant left,
323                         int leftId, int operator, Constant right, int rightId) {
324
325                 switch (operator) {
326                 case AND:
327                         return computeConstantOperationAND(left, leftId, operator, right,
328                                         rightId);
329                 case AND_AND:
330                         return computeConstantOperationAND_AND(left, leftId, operator,
331                                         right, rightId);
332                 case DIVIDE:
333                         return computeConstantOperationDIVIDE(left, leftId, operator,
334                                         right, rightId);
335                 case GREATER:
336                         return computeConstantOperationGREATER(left, leftId, operator,
337                                         right, rightId);
338                 case GREATER_EQUAL:
339                         return computeConstantOperationGREATER_EQUAL(left, leftId,
340                                         operator, right, rightId);
341                 case LEFT_SHIFT:
342                         return computeConstantOperationLEFT_SHIFT(left, leftId, operator,
343                                         right, rightId);
344                 case LESS:
345                         return computeConstantOperationLESS(left, leftId, operator, right,
346                                         rightId);
347                 case LESS_EQUAL:
348                         return computeConstantOperationLESS_EQUAL(left, leftId, operator,
349                                         right, rightId);
350                 case MINUS:
351                         return computeConstantOperationMINUS(left, leftId, operator, right,
352                                         rightId);
353                 case MULTIPLY:
354                         return computeConstantOperationMULTIPLY(left, leftId, operator,
355                                         right, rightId);
356                 case OR:
357                         return computeConstantOperationOR(left, leftId, operator, right,
358                                         rightId);
359                 case OR_OR:
360                         return computeConstantOperationOR_OR(left, leftId, operator, right,
361                                         rightId);
362                 case PLUS:
363                         return computeConstantOperationPLUS(left, leftId, operator, right,
364                                         rightId);
365                 case REMAINDER:
366                         return computeConstantOperationREMAINDER(left, leftId, operator,
367                                         right, rightId);
368                 case RIGHT_SHIFT:
369                         return computeConstantOperationRIGHT_SHIFT(left, leftId, operator,
370                                         right, rightId);
371                 case UNSIGNED_RIGHT_SHIFT:
372                         return computeConstantOperationUNSIGNED_RIGHT_SHIFT(left, leftId,
373                                         operator, right, rightId);
374                 case XOR:
375                         return computeConstantOperationXOR(left, leftId, operator, right,
376                                         rightId);
377
378                 default:
379                         return NotAConstant;
380                 }
381         }
382
383         public static final Constant computeConstantOperationAND(Constant left,
384                         int leftId, int operator, Constant right, int rightId) {
385
386                 switch (leftId) {
387                 case T_boolean:
388                         return Constant.fromValue(left.booleanValue()
389                                         & right.booleanValue());
390                 case T_char:
391                         switch (rightId) {
392                         case T_char:
393                                 return Constant.fromValue(left.charValue() & right.charValue());
394                         case T_byte:
395                                 return Constant.fromValue(left.charValue() & right.byteValue());
396                         case T_short:
397                                 return Constant
398                                                 .fromValue(left.charValue() & right.shortValue());
399                         case T_int:
400                                 return Constant.fromValue(left.charValue() & right.intValue());
401                         case T_long:
402                                 return Constant.fromValue(left.charValue() & right.longValue());
403                         }
404                         break;
405                 case T_byte:
406                         switch (rightId) {
407                         case T_char:
408                                 return Constant.fromValue(left.byteValue() & right.charValue());
409                         case T_byte:
410                                 return Constant.fromValue(left.byteValue() & right.byteValue());
411                         case T_short:
412                                 return Constant
413                                                 .fromValue(left.byteValue() & right.shortValue());
414                         case T_int:
415                                 return Constant.fromValue(left.byteValue() & right.intValue());
416                         case T_long:
417                                 return Constant.fromValue(left.byteValue() & right.longValue());
418                         }
419                         break;
420                 case T_short:
421                         switch (rightId) {
422                         case T_char:
423                                 return Constant
424                                                 .fromValue(left.shortValue() & right.charValue());
425                         case T_byte:
426                                 return Constant
427                                                 .fromValue(left.shortValue() & right.byteValue());
428                         case T_short:
429                                 return Constant.fromValue(left.shortValue()
430                                                 & right.shortValue());
431                         case T_int:
432                                 return Constant.fromValue(left.shortValue() & right.intValue());
433                         case T_long:
434                                 return Constant
435                                                 .fromValue(left.shortValue() & right.longValue());
436                         }
437                         break;
438                 case T_int:
439                         switch (rightId) {
440                         case T_char:
441                                 return Constant.fromValue(left.intValue() & right.charValue());
442                         case T_byte:
443                                 return Constant.fromValue(left.intValue() & right.byteValue());
444                         case T_short:
445                                 return Constant.fromValue(left.intValue() & right.shortValue());
446                         case T_int:
447                                 return Constant.fromValue(left.intValue() & right.intValue());
448                         case T_long:
449                                 return Constant.fromValue(left.intValue() & right.longValue());
450                         }
451                         break;
452                 case T_long:
453                         switch (rightId) {
454                         case T_char:
455                                 return Constant.fromValue(left.longValue() & right.charValue());
456                         case T_byte:
457                                 return Constant.fromValue(left.longValue() & right.byteValue());
458                         case T_short:
459                                 return Constant
460                                                 .fromValue(left.longValue() & right.shortValue());
461                         case T_int:
462                                 return Constant.fromValue(left.longValue() & right.intValue());
463                         case T_long:
464                                 return Constant.fromValue(left.longValue() & right.longValue());
465                         }
466                 }
467
468                 return NotAConstant;
469         }
470
471         public static final Constant computeConstantOperationAND_AND(Constant left,
472                         int leftId, int operator, Constant right, int rightId) {
473
474                 return Constant.fromValue(left.booleanValue() && right.booleanValue());
475         }
476
477         public static final Constant computeConstantOperationDIVIDE(Constant left,
478                         int leftId, int operator, Constant right, int rightId) {
479                 // division by zero must be handled outside this method (error
480                 // reporting)
481
482                 switch (leftId) {
483                 case T_char:
484                         switch (rightId) {
485                         case T_char:
486                                 return Constant.fromValue(left.charValue() / right.charValue());
487                         case T_float:
488                                 return Constant
489                                                 .fromValue(left.charValue() / right.floatValue());
490                         case T_double:
491                                 return Constant.fromValue(left.charValue()
492                                                 / right.doubleValue());
493                         case T_byte:
494                                 return Constant.fromValue(left.charValue() / right.byteValue());
495                         case T_short:
496                                 return Constant
497                                                 .fromValue(left.charValue() / right.shortValue());
498                         case T_int:
499                                 return Constant.fromValue(left.charValue() / right.intValue());
500                         case T_long:
501                                 return Constant.fromValue(left.charValue() / right.longValue());
502                         }
503                         break;
504                 case T_float:
505                         switch (rightId) {
506                         case T_char:
507                                 return Constant
508                                                 .fromValue(left.floatValue() / right.charValue());
509                         case T_float:
510                                 return Constant.fromValue(left.floatValue()
511                                                 / right.floatValue());
512                         case T_double:
513                                 return Constant.fromValue(left.floatValue()
514                                                 / right.doubleValue());
515                         case T_byte:
516                                 return Constant
517                                                 .fromValue(left.floatValue() / right.byteValue());
518                         case T_short:
519                                 return Constant.fromValue(left.floatValue()
520                                                 / right.shortValue());
521                         case T_int:
522                                 return Constant.fromValue(left.floatValue() / right.intValue());
523                         case T_long:
524                                 return Constant
525                                                 .fromValue(left.floatValue() / right.longValue());
526                         }
527                         break;
528                 case T_double:
529                         switch (rightId) {
530                         case T_char:
531                                 return Constant.fromValue(left.doubleValue()
532                                                 / right.charValue());
533                         case T_float:
534                                 return Constant.fromValue(left.doubleValue()
535                                                 / right.floatValue());
536                         case T_double:
537                                 return Constant.fromValue(left.doubleValue()
538                                                 / right.doubleValue());
539                         case T_byte:
540                                 return Constant.fromValue(left.doubleValue()
541                                                 / right.byteValue());
542                         case T_short:
543                                 return Constant.fromValue(left.doubleValue()
544                                                 / right.shortValue());
545                         case T_int:
546                                 return Constant
547                                                 .fromValue(left.doubleValue() / right.intValue());
548                         case T_long:
549                                 return Constant.fromValue(left.doubleValue()
550                                                 / right.longValue());
551                         }
552                         break;
553                 case T_byte:
554                         switch (rightId) {
555                         case T_char:
556                                 return Constant.fromValue(left.byteValue() / right.charValue());
557                         case T_float:
558                                 return Constant
559                                                 .fromValue(left.byteValue() / right.floatValue());
560                         case T_double:
561                                 return Constant.fromValue(left.byteValue()
562                                                 / right.doubleValue());
563                         case T_byte:
564                                 return Constant.fromValue(left.byteValue() / right.byteValue());
565                         case T_short:
566                                 return Constant
567                                                 .fromValue(left.byteValue() / right.shortValue());
568                         case T_int:
569                                 return Constant.fromValue(left.byteValue() / right.intValue());
570                         case T_long:
571                                 return Constant.fromValue(left.byteValue() / right.longValue());
572                         }
573                         break;
574                 case T_short:
575                         switch (rightId) {
576                         case T_char:
577                                 return Constant
578                                                 .fromValue(left.shortValue() / right.charValue());
579                         case T_float:
580                                 return Constant.fromValue(left.shortValue()
581                                                 / right.floatValue());
582                         case T_double:
583                                 return Constant.fromValue(left.shortValue()
584                                                 / right.doubleValue());
585                         case T_byte:
586                                 return Constant
587                                                 .fromValue(left.shortValue() / right.byteValue());
588                         case T_short:
589                                 return Constant.fromValue(left.shortValue()
590                                                 / right.shortValue());
591                         case T_int:
592                                 return Constant.fromValue(left.shortValue() / right.intValue());
593                         case T_long:
594                                 return Constant
595                                                 .fromValue(left.shortValue() / right.longValue());
596                         }
597                         break;
598                 case T_int:
599                         switch (rightId) {
600                         case T_char:
601                                 return Constant.fromValue(left.intValue() / right.charValue());
602                         case T_float:
603                                 return Constant.fromValue(left.intValue() / right.floatValue());
604                         case T_double:
605                                 return Constant
606                                                 .fromValue(left.intValue() / right.doubleValue());
607                         case T_byte:
608                                 return Constant.fromValue(left.intValue() / right.byteValue());
609                         case T_short:
610                                 return Constant.fromValue(left.intValue() / right.shortValue());
611                         case T_int:
612                                 return Constant.fromValue(left.intValue() / right.intValue());
613                         case T_long:
614                                 return Constant.fromValue(left.intValue() / right.longValue());
615                         }
616                         break;
617                 case T_long:
618                         switch (rightId) {
619                         case T_char:
620                                 return Constant.fromValue(left.longValue() / right.charValue());
621                         case T_float:
622                                 return Constant
623                                                 .fromValue(left.longValue() / right.floatValue());
624                         case T_double:
625                                 return Constant.fromValue(left.longValue()
626                                                 / right.doubleValue());
627                         case T_byte:
628                                 return Constant.fromValue(left.longValue() / right.byteValue());
629                         case T_short:
630                                 return Constant
631                                                 .fromValue(left.longValue() / right.shortValue());
632                         case T_int:
633                                 return Constant.fromValue(left.longValue() / right.intValue());
634                         case T_long:
635                                 return Constant.fromValue(left.longValue() / right.longValue());
636                         }
637
638                 }
639
640                 return NotAConstant;
641         }
642
643         public static final Constant computeConstantOperationEQUAL_EQUAL(
644                         Constant left, int leftId, int operator, Constant right, int rightId) {
645
646                 switch (leftId) {
647                 case T_boolean:
648                         if (rightId == T_boolean) {
649                                 return Constant.fromValue(left.booleanValue() == right
650                                                 .booleanValue());
651                         }
652                         break;
653                 case T_char:
654                         switch (rightId) {
655                         case T_char:
656                                 return Constant
657                                                 .fromValue(left.charValue() == right.charValue());
658                         case T_float:
659                                 return Constant.fromValue(left.charValue() == right
660                                                 .floatValue());
661                         case T_double:
662                                 return Constant.fromValue(left.charValue() == right
663                                                 .doubleValue());
664                         case T_byte:
665                                 return Constant
666                                                 .fromValue(left.charValue() == right.byteValue());
667                         case T_short:
668                                 return Constant.fromValue(left.charValue() == right
669                                                 .shortValue());
670                         case T_int:
671                                 return Constant.fromValue(left.charValue() == right.intValue());
672                         case T_long:
673                                 return Constant
674                                                 .fromValue(left.charValue() == right.longValue());
675                         }
676                         break;
677                 case T_float:
678                         switch (rightId) {
679                         case T_char:
680                                 return Constant.fromValue(left.floatValue() == right
681                                                 .charValue());
682                         case T_float:
683                                 return Constant.fromValue(left.floatValue() == right
684                                                 .floatValue());
685                         case T_double:
686                                 return Constant.fromValue(left.floatValue() == right
687                                                 .doubleValue());
688                         case T_byte:
689                                 return Constant.fromValue(left.floatValue() == right
690                                                 .byteValue());
691                         case T_short:
692                                 return Constant.fromValue(left.floatValue() == right
693                                                 .shortValue());
694                         case T_int:
695                                 return Constant
696                                                 .fromValue(left.floatValue() == right.intValue());
697                         case T_long:
698                                 return Constant.fromValue(left.floatValue() == right
699                                                 .longValue());
700                         }
701                         break;
702                 case T_double:
703                         switch (rightId) {
704                         case T_char:
705                                 return Constant.fromValue(left.doubleValue() == right
706                                                 .charValue());
707                         case T_float:
708                                 return Constant.fromValue(left.doubleValue() == right
709                                                 .floatValue());
710                         case T_double:
711                                 return Constant.fromValue(left.doubleValue() == right
712                                                 .doubleValue());
713                         case T_byte:
714                                 return Constant.fromValue(left.doubleValue() == right
715                                                 .byteValue());
716                         case T_short:
717                                 return Constant.fromValue(left.doubleValue() == right
718                                                 .shortValue());
719                         case T_int:
720                                 return Constant.fromValue(left.doubleValue() == right
721                                                 .intValue());
722                         case T_long:
723                                 return Constant.fromValue(left.doubleValue() == right
724                                                 .longValue());
725                         }
726                         break;
727                 case T_byte:
728                         switch (rightId) {
729                         case T_char:
730                                 return Constant
731                                                 .fromValue(left.byteValue() == right.charValue());
732                         case T_float:
733                                 return Constant.fromValue(left.byteValue() == right
734                                                 .floatValue());
735                         case T_double:
736                                 return Constant.fromValue(left.byteValue() == right
737                                                 .doubleValue());
738                         case T_byte:
739                                 return Constant
740                                                 .fromValue(left.byteValue() == right.byteValue());
741                         case T_short:
742                                 return Constant.fromValue(left.byteValue() == right
743                                                 .shortValue());
744                         case T_int:
745                                 return Constant.fromValue(left.byteValue() == right.intValue());
746                         case T_long:
747                                 return Constant
748                                                 .fromValue(left.byteValue() == right.longValue());
749                         }
750                         break;
751                 case T_short:
752                         switch (rightId) {
753                         case T_char:
754                                 return Constant.fromValue(left.shortValue() == right
755                                                 .charValue());
756                         case T_float:
757                                 return Constant.fromValue(left.shortValue() == right
758                                                 .floatValue());
759                         case T_double:
760                                 return Constant.fromValue(left.shortValue() == right
761                                                 .doubleValue());
762                         case T_byte:
763                                 return Constant.fromValue(left.shortValue() == right
764                                                 .byteValue());
765                         case T_short:
766                                 return Constant.fromValue(left.shortValue() == right
767                                                 .shortValue());
768                         case T_int:
769                                 return Constant
770                                                 .fromValue(left.shortValue() == right.intValue());
771                         case T_long:
772                                 return Constant.fromValue(left.shortValue() == right
773                                                 .longValue());
774                         }
775                         break;
776                 case T_int:
777                         switch (rightId) {
778                         case T_char:
779                                 return Constant.fromValue(left.intValue() == right.charValue());
780                         case T_float:
781                                 return Constant
782                                                 .fromValue(left.intValue() == right.floatValue());
783                         case T_double:
784                                 return Constant.fromValue(left.intValue() == right
785                                                 .doubleValue());
786                         case T_byte:
787                                 return Constant.fromValue(left.intValue() == right.byteValue());
788                         case T_short:
789                                 return Constant
790                                                 .fromValue(left.intValue() == right.shortValue());
791                         case T_int:
792                                 return Constant.fromValue(left.intValue() == right.intValue());
793                         case T_long:
794                                 return Constant.fromValue(left.intValue() == right.longValue());
795                         }
796                         break;
797                 case T_long:
798                         switch (rightId) {
799                         case T_char:
800                                 return Constant
801                                                 .fromValue(left.longValue() == right.charValue());
802                         case T_float:
803                                 return Constant.fromValue(left.longValue() == right
804                                                 .floatValue());
805                         case T_double:
806                                 return Constant.fromValue(left.longValue() == right
807                                                 .doubleValue());
808                         case T_byte:
809                                 return Constant
810                                                 .fromValue(left.longValue() == right.byteValue());
811                         case T_short:
812                                 return Constant.fromValue(left.longValue() == right
813                                                 .shortValue());
814                         case T_int:
815                                 return Constant.fromValue(left.longValue() == right.intValue());
816                         case T_long:
817                                 return Constant
818                                                 .fromValue(left.longValue() == right.longValue());
819                         }
820                         break;
821                 case T_String:
822                         if (rightId == T_String) {
823                                 // String are interned in th compiler==>thus if two string
824                                 // constant
825                                 // get to be compared, it is an equal on the vale which is done
826                                 return Constant.fromValue(((StringConstant) left)
827                                                 .compileTimeEqual((StringConstant) right));
828                         }
829                         break;
830                 case T_null:
831                         if (rightId == T_String) {
832                                 return Constant.fromValue(false);
833                         } else {
834                                 if (rightId == T_null) {
835                                         return Constant.fromValue(true);
836                                 }
837                         }
838                 }
839
840                 return Constant.fromValue(false);
841         }
842
843         public static final Constant computeConstantOperationGREATER(Constant left,
844                         int leftId, int operator, Constant right, int rightId) {
845
846                 switch (leftId) {
847                 case T_char:
848                         switch (rightId) {
849                         case T_char:
850                                 return Constant.fromValue(left.charValue() > right.charValue());
851                         case T_float:
852                                 return Constant
853                                                 .fromValue(left.charValue() > right.floatValue());
854                         case T_double:
855                                 return Constant.fromValue(left.charValue() > right
856                                                 .doubleValue());
857                         case T_byte:
858                                 return Constant.fromValue(left.charValue() > right.byteValue());
859                         case T_short:
860                                 return Constant
861                                                 .fromValue(left.charValue() > right.shortValue());
862                         case T_int:
863                                 return Constant.fromValue(left.charValue() > right.intValue());
864                         case T_long:
865                                 return Constant.fromValue(left.charValue() > right.longValue());
866                         }
867                         break;
868                 case T_float:
869                         switch (rightId) {
870                         case T_char:
871                                 return Constant
872                                                 .fromValue(left.floatValue() > right.charValue());
873                         case T_float:
874                                 return Constant.fromValue(left.floatValue() > right
875                                                 .floatValue());
876                         case T_double:
877                                 return Constant.fromValue(left.floatValue() > right
878                                                 .doubleValue());
879                         case T_byte:
880                                 return Constant
881                                                 .fromValue(left.floatValue() > right.byteValue());
882                         case T_short:
883                                 return Constant.fromValue(left.floatValue() > right
884                                                 .shortValue());
885                         case T_int:
886                                 return Constant.fromValue(left.floatValue() > right.intValue());
887                         case T_long:
888                                 return Constant
889                                                 .fromValue(left.floatValue() > right.longValue());
890                         }
891                         break;
892                 case T_double:
893                         switch (rightId) {
894                         case T_char:
895                                 return Constant.fromValue(left.doubleValue() > right
896                                                 .charValue());
897                         case T_float:
898                                 return Constant.fromValue(left.doubleValue() > right
899                                                 .floatValue());
900                         case T_double:
901                                 return Constant.fromValue(left.doubleValue() > right
902                                                 .doubleValue());
903                         case T_byte:
904                                 return Constant.fromValue(left.doubleValue() > right
905                                                 .byteValue());
906                         case T_short:
907                                 return Constant.fromValue(left.doubleValue() > right
908                                                 .shortValue());
909                         case T_int:
910                                 return Constant
911                                                 .fromValue(left.doubleValue() > right.intValue());
912                         case T_long:
913                                 return Constant.fromValue(left.doubleValue() > right
914                                                 .longValue());
915                         }
916                         break;
917                 case T_byte:
918                         switch (rightId) {
919                         case T_char:
920                                 return Constant.fromValue(left.byteValue() > right.charValue());
921                         case T_float:
922                                 return Constant
923                                                 .fromValue(left.byteValue() > right.floatValue());
924                         case T_double:
925                                 return Constant.fromValue(left.byteValue() > right
926                                                 .doubleValue());
927                         case T_byte:
928                                 return Constant.fromValue(left.byteValue() > right.byteValue());
929                         case T_short:
930                                 return Constant
931                                                 .fromValue(left.byteValue() > right.shortValue());
932                         case T_int:
933                                 return Constant.fromValue(left.byteValue() > right.intValue());
934                         case T_long:
935                                 return Constant.fromValue(left.byteValue() > right.longValue());
936                         }
937                         break;
938                 case T_short:
939                         switch (rightId) {
940                         case T_char:
941                                 return Constant
942                                                 .fromValue(left.shortValue() > right.charValue());
943                         case T_float:
944                                 return Constant.fromValue(left.shortValue() > right
945                                                 .floatValue());
946                         case T_double:
947                                 return Constant.fromValue(left.shortValue() > right
948                                                 .doubleValue());
949                         case T_byte:
950                                 return Constant
951                                                 .fromValue(left.shortValue() > right.byteValue());
952                         case T_short:
953                                 return Constant.fromValue(left.shortValue() > right
954                                                 .shortValue());
955                         case T_int:
956                                 return Constant.fromValue(left.shortValue() > right.intValue());
957                         case T_long:
958                                 return Constant
959                                                 .fromValue(left.shortValue() > right.longValue());
960                         }
961                         break;
962                 case T_int:
963                         switch (rightId) {
964                         case T_char:
965                                 return Constant.fromValue(left.intValue() > right.charValue());
966                         case T_float:
967                                 return Constant.fromValue(left.intValue() > right.floatValue());
968                         case T_double:
969                                 return Constant
970                                                 .fromValue(left.intValue() > right.doubleValue());
971                         case T_byte:
972                                 return Constant.fromValue(left.intValue() > right.byteValue());
973                         case T_short:
974                                 return Constant.fromValue(left.intValue() > right.shortValue());
975                         case T_int:
976                                 return Constant.fromValue(left.intValue() > right.intValue());
977                         case T_long:
978                                 return Constant.fromValue(left.intValue() > right.longValue());
979                         }
980                         break;
981                 case T_long:
982                         switch (rightId) {
983                         case T_char:
984                                 return Constant.fromValue(left.longValue() > right.charValue());
985                         case T_float:
986                                 return Constant
987                                                 .fromValue(left.longValue() > right.floatValue());
988                         case T_double:
989                                 return Constant.fromValue(left.longValue() > right
990                                                 .doubleValue());
991                         case T_byte:
992                                 return Constant.fromValue(left.longValue() > right.byteValue());
993                         case T_short:
994                                 return Constant
995                                                 .fromValue(left.longValue() > right.shortValue());
996                         case T_int:
997                                 return Constant.fromValue(left.longValue() > right.intValue());
998                         case T_long:
999                                 return Constant.fromValue(left.longValue() > right.longValue());
1000                         }
1001
1002                 }
1003
1004                 return NotAConstant;
1005         }
1006
1007         public static final Constant computeConstantOperationGREATER_EQUAL(
1008                         Constant left, int leftId, int operator, Constant right, int rightId) {
1009
1010                 switch (leftId) {
1011                 case T_char:
1012                         switch (rightId) {
1013                         case T_char:
1014                                 return Constant
1015                                                 .fromValue(left.charValue() >= right.charValue());
1016                         case T_float:
1017                                 return Constant.fromValue(left.charValue() >= right
1018                                                 .floatValue());
1019                         case T_double:
1020                                 return Constant.fromValue(left.charValue() >= right
1021                                                 .doubleValue());
1022                         case T_byte:
1023                                 return Constant
1024                                                 .fromValue(left.charValue() >= right.byteValue());
1025                         case T_short:
1026                                 return Constant.fromValue(left.charValue() >= right
1027                                                 .shortValue());
1028                         case T_int:
1029                                 return Constant.fromValue(left.charValue() >= right.intValue());
1030                         case T_long:
1031                                 return Constant
1032                                                 .fromValue(left.charValue() >= right.longValue());
1033                         }
1034                         break;
1035                 case T_float:
1036                         switch (rightId) {
1037                         case T_char:
1038                                 return Constant.fromValue(left.floatValue() >= right
1039                                                 .charValue());
1040                         case T_float:
1041                                 return Constant.fromValue(left.floatValue() >= right
1042                                                 .floatValue());
1043                         case T_double:
1044                                 return Constant.fromValue(left.floatValue() >= right
1045                                                 .doubleValue());
1046                         case T_byte:
1047                                 return Constant.fromValue(left.floatValue() >= right
1048                                                 .byteValue());
1049                         case T_short:
1050                                 return Constant.fromValue(left.floatValue() >= right
1051                                                 .shortValue());
1052                         case T_int:
1053                                 return Constant
1054                                                 .fromValue(left.floatValue() >= right.intValue());
1055                         case T_long:
1056                                 return Constant.fromValue(left.floatValue() >= right
1057                                                 .longValue());
1058                         }
1059                         break;
1060                 case T_double:
1061                         switch (rightId) {
1062                         case T_char:
1063                                 return Constant.fromValue(left.doubleValue() >= right
1064                                                 .charValue());
1065                         case T_float:
1066                                 return Constant.fromValue(left.doubleValue() >= right
1067                                                 .floatValue());
1068                         case T_double:
1069                                 return Constant.fromValue(left.doubleValue() >= right
1070                                                 .doubleValue());
1071                         case T_byte:
1072                                 return Constant.fromValue(left.doubleValue() >= right
1073                                                 .byteValue());
1074                         case T_short:
1075                                 return Constant.fromValue(left.doubleValue() >= right
1076                                                 .shortValue());
1077                         case T_int:
1078                                 return Constant.fromValue(left.doubleValue() >= right
1079                                                 .intValue());
1080                         case T_long:
1081                                 return Constant.fromValue(left.doubleValue() >= right
1082                                                 .longValue());
1083                         }
1084                         break;
1085                 case T_byte:
1086                         switch (rightId) {
1087                         case T_char:
1088                                 return Constant
1089                                                 .fromValue(left.byteValue() >= right.charValue());
1090                         case T_float:
1091                                 return Constant.fromValue(left.byteValue() >= right
1092                                                 .floatValue());
1093                         case T_double:
1094                                 return Constant.fromValue(left.byteValue() >= right
1095                                                 .doubleValue());
1096                         case T_byte:
1097                                 return Constant
1098                                                 .fromValue(left.byteValue() >= right.byteValue());
1099                         case T_short:
1100                                 return Constant.fromValue(left.byteValue() >= right
1101                                                 .shortValue());
1102                         case T_int:
1103                                 return Constant.fromValue(left.byteValue() >= right.intValue());
1104                         case T_long:
1105                                 return Constant
1106                                                 .fromValue(left.byteValue() >= right.longValue());
1107                         }
1108                         break;
1109                 case T_short:
1110                         switch (rightId) {
1111                         case T_char:
1112                                 return Constant.fromValue(left.shortValue() >= right
1113                                                 .charValue());
1114                         case T_float:
1115                                 return Constant.fromValue(left.shortValue() >= right
1116                                                 .floatValue());
1117                         case T_double:
1118                                 return Constant.fromValue(left.shortValue() >= right
1119                                                 .doubleValue());
1120                         case T_byte:
1121                                 return Constant.fromValue(left.shortValue() >= right
1122                                                 .byteValue());
1123                         case T_short:
1124                                 return Constant.fromValue(left.shortValue() >= right
1125                                                 .shortValue());
1126                         case T_int:
1127                                 return Constant
1128                                                 .fromValue(left.shortValue() >= right.intValue());
1129                         case T_long:
1130                                 return Constant.fromValue(left.shortValue() >= right
1131                                                 .longValue());
1132                         }
1133                         break;
1134                 case T_int:
1135                         switch (rightId) {
1136                         case T_char:
1137                                 return Constant.fromValue(left.intValue() >= right.charValue());
1138                         case T_float:
1139                                 return Constant
1140                                                 .fromValue(left.intValue() >= right.floatValue());
1141                         case T_double:
1142                                 return Constant.fromValue(left.intValue() >= right
1143                                                 .doubleValue());
1144                         case T_byte:
1145                                 return Constant.fromValue(left.intValue() >= right.byteValue());
1146                         case T_short:
1147                                 return Constant
1148                                                 .fromValue(left.intValue() >= right.shortValue());
1149                         case T_int:
1150                                 return Constant.fromValue(left.intValue() >= right.intValue());
1151                         case T_long:
1152                                 return Constant.fromValue(left.intValue() >= right.longValue());
1153                         }
1154                         break;
1155                 case T_long:
1156                         switch (rightId) {
1157                         case T_char:
1158                                 return Constant
1159                                                 .fromValue(left.longValue() >= right.charValue());
1160                         case T_float:
1161                                 return Constant.fromValue(left.longValue() >= right
1162                                                 .floatValue());
1163                         case T_double:
1164                                 return Constant.fromValue(left.longValue() >= right
1165                                                 .doubleValue());
1166                         case T_byte:
1167                                 return Constant
1168                                                 .fromValue(left.longValue() >= right.byteValue());
1169                         case T_short:
1170                                 return Constant.fromValue(left.longValue() >= right
1171                                                 .shortValue());
1172                         case T_int:
1173                                 return Constant.fromValue(left.longValue() >= right.intValue());
1174                         case T_long:
1175                                 return Constant
1176                                                 .fromValue(left.longValue() >= right.longValue());
1177                         }
1178
1179                 }
1180
1181                 return NotAConstant;
1182         }
1183
1184         public static final Constant computeConstantOperationLEFT_SHIFT(
1185                         Constant left, int leftId, int operator, Constant right, int rightId) {
1186
1187                 switch (leftId) {
1188                 case T_char:
1189                         switch (rightId) {
1190                         case T_char:
1191                                 return Constant
1192                                                 .fromValue(left.charValue() << right.charValue());
1193                         case T_byte:
1194                                 return Constant
1195                                                 .fromValue(left.charValue() << right.byteValue());
1196                         case T_short:
1197                                 return Constant.fromValue(left.charValue() << right
1198                                                 .shortValue());
1199                         case T_int:
1200                                 return Constant.fromValue(left.charValue() << right.intValue());
1201                         case T_long:
1202                                 return Constant
1203                                                 .fromValue(left.charValue() << right.longValue());
1204                         }
1205                         break;
1206                 case T_byte:
1207                         switch (rightId) {
1208                         case T_char:
1209                                 return Constant
1210                                                 .fromValue(left.byteValue() << right.charValue());
1211                         case T_byte:
1212                                 return Constant
1213                                                 .fromValue(left.byteValue() << right.byteValue());
1214                         case T_short:
1215                                 return Constant.fromValue(left.byteValue() << right
1216                                                 .shortValue());
1217                         case T_int:
1218                                 return Constant.fromValue(left.byteValue() << right.intValue());
1219                         case T_long:
1220                                 return Constant
1221                                                 .fromValue(left.byteValue() << right.longValue());
1222                         }
1223                         break;
1224                 case T_short:
1225                         switch (rightId) {
1226                         case T_char:
1227                                 return Constant.fromValue(left.shortValue() << right
1228                                                 .charValue());
1229                         case T_byte:
1230                                 return Constant.fromValue(left.shortValue() << right
1231                                                 .byteValue());
1232                         case T_short:
1233                                 return Constant.fromValue(left.shortValue() << right
1234                                                 .shortValue());
1235                         case T_int:
1236                                 return Constant
1237                                                 .fromValue(left.shortValue() << right.intValue());
1238                         case T_long:
1239                                 return Constant.fromValue(left.shortValue() << right
1240                                                 .longValue());
1241                         }
1242                         break;
1243                 case T_int:
1244                         switch (rightId) {
1245                         case T_char:
1246                                 return Constant.fromValue(left.intValue() << right.charValue());
1247                         case T_byte:
1248                                 return Constant.fromValue(left.intValue() << right.byteValue());
1249                         case T_short:
1250                                 return Constant
1251                                                 .fromValue(left.intValue() << right.shortValue());
1252                         case T_int:
1253                                 return Constant.fromValue(left.intValue() << right.intValue());
1254                         case T_long:
1255                                 return Constant.fromValue(left.intValue() << right.longValue());
1256                         }
1257                         break;
1258                 case T_long:
1259                         switch (rightId) {
1260                         case T_char:
1261                                 return Constant
1262                                                 .fromValue(left.longValue() << right.charValue());
1263                         case T_byte:
1264                                 return Constant
1265                                                 .fromValue(left.longValue() << right.byteValue());
1266                         case T_short:
1267                                 return Constant.fromValue(left.longValue() << right
1268                                                 .shortValue());
1269                         case T_int:
1270                                 return Constant.fromValue(left.longValue() << right.intValue());
1271                         case T_long:
1272                                 return Constant
1273                                                 .fromValue(left.longValue() << right.longValue());
1274                         }
1275
1276                 }
1277
1278                 return NotAConstant;
1279         }
1280
1281         public static final Constant computeConstantOperationLESS(Constant left,
1282                         int leftId, int operator, Constant right, int rightId) {
1283
1284                 switch (leftId) {
1285                 case T_char:
1286                         switch (rightId) {
1287                         case T_char:
1288                                 return Constant.fromValue(left.charValue() < right.charValue());
1289                         case T_float:
1290                                 return Constant
1291                                                 .fromValue(left.charValue() < right.floatValue());
1292                         case T_double:
1293                                 return Constant.fromValue(left.charValue() < right
1294                                                 .doubleValue());
1295                         case T_byte:
1296                                 return Constant.fromValue(left.charValue() < right.byteValue());
1297                         case T_short:
1298                                 return Constant
1299                                                 .fromValue(left.charValue() < right.shortValue());
1300                         case T_int:
1301                                 return Constant.fromValue(left.charValue() < right.intValue());
1302                         case T_long:
1303                                 return Constant.fromValue(left.charValue() < right.longValue());
1304                         }
1305                         break;
1306                 case T_float:
1307                         switch (rightId) {
1308                         case T_char:
1309                                 return Constant
1310                                                 .fromValue(left.floatValue() < right.charValue());
1311                         case T_float:
1312                                 return Constant.fromValue(left.floatValue() < right
1313                                                 .floatValue());
1314                         case T_double:
1315                                 return Constant.fromValue(left.floatValue() < right
1316                                                 .doubleValue());
1317                         case T_byte:
1318                                 return Constant
1319                                                 .fromValue(left.floatValue() < right.byteValue());
1320                         case T_short:
1321                                 return Constant.fromValue(left.floatValue() < right
1322                                                 .shortValue());
1323                         case T_int:
1324                                 return Constant.fromValue(left.floatValue() < right.intValue());
1325                         case T_long:
1326                                 return Constant
1327                                                 .fromValue(left.floatValue() < right.longValue());
1328                         }
1329                         break;
1330                 case T_double:
1331                         switch (rightId) {
1332                         case T_char:
1333                                 return Constant.fromValue(left.doubleValue() < right
1334                                                 .charValue());
1335                         case T_float:
1336                                 return Constant.fromValue(left.doubleValue() < right
1337                                                 .floatValue());
1338                         case T_double:
1339                                 return Constant.fromValue(left.doubleValue() < right
1340                                                 .doubleValue());
1341                         case T_byte:
1342                                 return Constant.fromValue(left.doubleValue() < right
1343                                                 .byteValue());
1344                         case T_short:
1345                                 return Constant.fromValue(left.doubleValue() < right
1346                                                 .shortValue());
1347                         case T_int:
1348                                 return Constant
1349                                                 .fromValue(left.doubleValue() < right.intValue());
1350                         case T_long:
1351                                 return Constant.fromValue(left.doubleValue() < right
1352                                                 .longValue());
1353                         }
1354                         break;
1355                 case T_byte:
1356                         switch (rightId) {
1357                         case T_char:
1358                                 return Constant.fromValue(left.byteValue() < right.charValue());
1359                         case T_float:
1360                                 return Constant
1361                                                 .fromValue(left.byteValue() < right.floatValue());
1362                         case T_double:
1363                                 return Constant.fromValue(left.byteValue() < right
1364                                                 .doubleValue());
1365                         case T_byte:
1366                                 return Constant.fromValue(left.byteValue() < right.byteValue());
1367                         case T_short:
1368                                 return Constant
1369                                                 .fromValue(left.byteValue() < right.shortValue());
1370                         case T_int:
1371                                 return Constant.fromValue(left.byteValue() < right.intValue());
1372                         case T_long:
1373                                 return Constant.fromValue(left.byteValue() < right.longValue());
1374                         }
1375                         break;
1376                 case T_short:
1377                         switch (rightId) {
1378                         case T_char:
1379                                 return Constant
1380                                                 .fromValue(left.shortValue() < right.charValue());
1381                         case T_float:
1382                                 return Constant.fromValue(left.shortValue() < right
1383                                                 .floatValue());
1384                         case T_double:
1385                                 return Constant.fromValue(left.shortValue() < right
1386                                                 .doubleValue());
1387                         case T_byte:
1388                                 return Constant
1389                                                 .fromValue(left.shortValue() < right.byteValue());
1390                         case T_short:
1391                                 return Constant.fromValue(left.shortValue() < right
1392                                                 .shortValue());
1393                         case T_int:
1394                                 return Constant.fromValue(left.shortValue() < right.intValue());
1395                         case T_long:
1396                                 return Constant
1397                                                 .fromValue(left.shortValue() < right.longValue());
1398                         }
1399                         break;
1400                 case T_int:
1401                         switch (rightId) {
1402                         case T_char:
1403                                 return Constant.fromValue(left.intValue() < right.charValue());
1404                         case T_float:
1405                                 return Constant.fromValue(left.intValue() < right.floatValue());
1406                         case T_double:
1407                                 return Constant
1408                                                 .fromValue(left.intValue() < right.doubleValue());
1409                         case T_byte:
1410                                 return Constant.fromValue(left.intValue() < right.byteValue());
1411                         case T_short:
1412                                 return Constant.fromValue(left.intValue() < right.shortValue());
1413                         case T_int:
1414                                 return Constant.fromValue(left.intValue() < right.intValue());
1415                         case T_long:
1416                                 return Constant.fromValue(left.intValue() < right.longValue());
1417                         }
1418                         break;
1419                 case T_long:
1420                         switch (rightId) {
1421                         case T_char:
1422                                 return Constant.fromValue(left.longValue() < right.charValue());
1423                         case T_float:
1424                                 return Constant
1425                                                 .fromValue(left.longValue() < right.floatValue());
1426                         case T_double:
1427                                 return Constant.fromValue(left.longValue() < right
1428                                                 .doubleValue());
1429                         case T_byte:
1430                                 return Constant.fromValue(left.longValue() < right.byteValue());
1431                         case T_short:
1432                                 return Constant
1433                                                 .fromValue(left.longValue() < right.shortValue());
1434                         case T_int:
1435                                 return Constant.fromValue(left.longValue() < right.intValue());
1436                         case T_long:
1437                                 return Constant.fromValue(left.longValue() < right.longValue());
1438                         }
1439
1440                 }
1441
1442                 return NotAConstant;
1443         }
1444
1445         public static final Constant computeConstantOperationLESS_EQUAL(
1446                         Constant left, int leftId, int operator, Constant right, int rightId) {
1447
1448                 switch (leftId) {
1449                 case T_char:
1450                         switch (rightId) {
1451                         case T_char:
1452                                 return Constant
1453                                                 .fromValue(left.charValue() <= right.charValue());
1454                         case T_float:
1455                                 return Constant.fromValue(left.charValue() <= right
1456                                                 .floatValue());
1457                         case T_double:
1458                                 return Constant.fromValue(left.charValue() <= right
1459                                                 .doubleValue());
1460                         case T_byte:
1461                                 return Constant
1462                                                 .fromValue(left.charValue() <= right.byteValue());
1463                         case T_short:
1464                                 return Constant.fromValue(left.charValue() <= right
1465                                                 .shortValue());
1466                         case T_int:
1467                                 return Constant.fromValue(left.charValue() <= right.intValue());
1468                         case T_long:
1469                                 return Constant
1470                                                 .fromValue(left.charValue() <= right.longValue());
1471                         }
1472                         break;
1473                 case T_float:
1474                         switch (rightId) {
1475                         case T_char:
1476                                 return Constant.fromValue(left.floatValue() <= right
1477                                                 .charValue());
1478                         case T_float:
1479                                 return Constant.fromValue(left.floatValue() <= right
1480                                                 .floatValue());
1481                         case T_double:
1482                                 return Constant.fromValue(left.floatValue() <= right
1483                                                 .doubleValue());
1484                         case T_byte:
1485                                 return Constant.fromValue(left.floatValue() <= right
1486                                                 .byteValue());
1487                         case T_short:
1488                                 return Constant.fromValue(left.floatValue() <= right
1489                                                 .shortValue());
1490                         case T_int:
1491                                 return Constant
1492                                                 .fromValue(left.floatValue() <= right.intValue());
1493                         case T_long:
1494                                 return Constant.fromValue(left.floatValue() <= right
1495                                                 .longValue());
1496                         }
1497                         break;
1498                 case T_double:
1499                         switch (rightId) {
1500                         case T_char:
1501                                 return Constant.fromValue(left.doubleValue() <= right
1502                                                 .charValue());
1503                         case T_float:
1504                                 return Constant.fromValue(left.doubleValue() <= right
1505                                                 .floatValue());
1506                         case T_double:
1507                                 return Constant.fromValue(left.doubleValue() <= right
1508                                                 .doubleValue());
1509                         case T_byte:
1510                                 return Constant.fromValue(left.doubleValue() <= right
1511                                                 .byteValue());
1512                         case T_short:
1513                                 return Constant.fromValue(left.doubleValue() <= right
1514                                                 .shortValue());
1515                         case T_int:
1516                                 return Constant.fromValue(left.doubleValue() <= right
1517                                                 .intValue());
1518                         case T_long:
1519                                 return Constant.fromValue(left.doubleValue() <= right
1520                                                 .longValue());
1521                         }
1522                         break;
1523                 case T_byte:
1524                         switch (rightId) {
1525                         case T_char:
1526                                 return Constant
1527                                                 .fromValue(left.byteValue() <= right.charValue());
1528                         case T_float:
1529                                 return Constant.fromValue(left.byteValue() <= right
1530                                                 .floatValue());
1531                         case T_double:
1532                                 return Constant.fromValue(left.byteValue() <= right
1533                                                 .doubleValue());
1534                         case T_byte:
1535                                 return Constant
1536                                                 .fromValue(left.byteValue() <= right.byteValue());
1537                         case T_short:
1538                                 return Constant.fromValue(left.byteValue() <= right
1539                                                 .shortValue());
1540                         case T_int:
1541                                 return Constant.fromValue(left.byteValue() <= right.intValue());
1542                         case T_long:
1543                                 return Constant
1544                                                 .fromValue(left.byteValue() <= right.longValue());
1545                         }
1546                         break;
1547                 case T_short:
1548                         switch (rightId) {
1549                         case T_char:
1550                                 return Constant.fromValue(left.shortValue() <= right
1551                                                 .charValue());
1552                         case T_float:
1553                                 return Constant.fromValue(left.shortValue() <= right
1554                                                 .floatValue());
1555                         case T_double:
1556                                 return Constant.fromValue(left.shortValue() <= right
1557                                                 .doubleValue());
1558                         case T_byte:
1559                                 return Constant.fromValue(left.shortValue() <= right
1560                                                 .byteValue());
1561                         case T_short:
1562                                 return Constant.fromValue(left.shortValue() <= right
1563                                                 .shortValue());
1564                         case T_int:
1565                                 return Constant
1566                                                 .fromValue(left.shortValue() <= right.intValue());
1567                         case T_long:
1568                                 return Constant.fromValue(left.shortValue() <= right
1569                                                 .longValue());
1570                         }
1571                         break;
1572                 case T_int:
1573                         switch (rightId) {
1574                         case T_char:
1575                                 return Constant.fromValue(left.intValue() <= right.charValue());
1576                         case T_float:
1577                                 return Constant
1578                                                 .fromValue(left.intValue() <= right.floatValue());
1579                         case T_double:
1580                                 return Constant.fromValue(left.intValue() <= right
1581                                                 .doubleValue());
1582                         case T_byte:
1583                                 return Constant.fromValue(left.intValue() <= right.byteValue());
1584                         case T_short:
1585                                 return Constant
1586                                                 .fromValue(left.intValue() <= right.shortValue());
1587                         case T_int:
1588                                 return Constant.fromValue(left.intValue() <= right.intValue());
1589                         case T_long:
1590                                 return Constant.fromValue(left.intValue() <= right.longValue());
1591                         }
1592                         break;
1593                 case T_long:
1594                         switch (rightId) {
1595                         case T_char:
1596                                 return Constant
1597                                                 .fromValue(left.longValue() <= right.charValue());
1598                         case T_float:
1599                                 return Constant.fromValue(left.longValue() <= right
1600                                                 .floatValue());
1601                         case T_double:
1602                                 return Constant.fromValue(left.longValue() <= right
1603                                                 .doubleValue());
1604                         case T_byte:
1605                                 return Constant
1606                                                 .fromValue(left.longValue() <= right.byteValue());
1607                         case T_short:
1608                                 return Constant.fromValue(left.longValue() <= right
1609                                                 .shortValue());
1610                         case T_int:
1611                                 return Constant.fromValue(left.longValue() <= right.intValue());
1612                         case T_long:
1613                                 return Constant
1614                                                 .fromValue(left.longValue() <= right.longValue());
1615                         }
1616                 }
1617
1618                 return NotAConstant;
1619         }
1620
1621         public static final Constant computeConstantOperationMINUS(Constant left,
1622                         int leftId, int operator, Constant right, int rightId) {
1623
1624                 switch (leftId) {
1625                 case T_char:
1626                         switch (rightId) {
1627                         case T_char:
1628                                 return Constant.fromValue(left.charValue() - right.charValue());
1629                         case T_float:
1630                                 return Constant
1631                                                 .fromValue(left.charValue() - right.floatValue());
1632                         case T_double:
1633                                 return Constant.fromValue(left.charValue()
1634                                                 - right.doubleValue());
1635                         case T_byte:
1636                                 return Constant.fromValue(left.charValue() - right.byteValue());
1637                         case T_short:
1638                                 return Constant
1639                                                 .fromValue(left.charValue() - right.shortValue());
1640                         case T_int:
1641                                 return Constant.fromValue(left.charValue() - right.intValue());
1642                         case T_long:
1643                                 return Constant.fromValue(left.charValue() - right.longValue());
1644                         }
1645                         break;
1646                 case T_float:
1647                         switch (rightId) {
1648                         case T_char:
1649                                 return Constant
1650                                                 .fromValue(left.floatValue() - right.charValue());
1651                         case T_float:
1652                                 return Constant.fromValue(left.floatValue()
1653                                                 - right.floatValue());
1654                         case T_double:
1655                                 return Constant.fromValue(left.floatValue()
1656                                                 - right.doubleValue());
1657                         case T_byte:
1658                                 return Constant
1659                                                 .fromValue(left.floatValue() - right.byteValue());
1660                         case T_short:
1661                                 return Constant.fromValue(left.floatValue()
1662                                                 - right.shortValue());
1663                         case T_int:
1664                                 return Constant.fromValue(left.floatValue() - right.intValue());
1665                         case T_long:
1666                                 return Constant
1667                                                 .fromValue(left.floatValue() - right.longValue());
1668                         }
1669                         break;
1670                 case T_double:
1671                         switch (rightId) {
1672                         case T_char:
1673                                 return Constant.fromValue(left.doubleValue()
1674                                                 - right.charValue());
1675                         case T_float:
1676                                 return Constant.fromValue(left.doubleValue()
1677                                                 - right.floatValue());
1678                         case T_double:
1679                                 return Constant.fromValue(left.doubleValue()
1680                                                 - right.doubleValue());
1681                         case T_byte:
1682                                 return Constant.fromValue(left.doubleValue()
1683                                                 - right.byteValue());
1684                         case T_short:
1685                                 return Constant.fromValue(left.doubleValue()
1686                                                 - right.shortValue());
1687                         case T_int:
1688                                 return Constant
1689                                                 .fromValue(left.doubleValue() - right.intValue());
1690                         case T_long:
1691                                 return Constant.fromValue(left.doubleValue()
1692                                                 - right.longValue());
1693                         }
1694                         break;
1695                 case T_byte:
1696                         switch (rightId) {
1697                         case T_char:
1698                                 return Constant.fromValue(left.byteValue() - right.charValue());
1699                         case T_float:
1700                                 return Constant
1701                                                 .fromValue(left.byteValue() - right.floatValue());
1702                         case T_double:
1703                                 return Constant.fromValue(left.byteValue()
1704                                                 - right.doubleValue());
1705                         case T_byte:
1706                                 return Constant.fromValue(left.byteValue() - right.byteValue());
1707                         case T_short:
1708                                 return Constant
1709                                                 .fromValue(left.byteValue() - right.shortValue());
1710                         case T_int:
1711                                 return Constant.fromValue(left.byteValue() - right.intValue());
1712                         case T_long:
1713                                 return Constant.fromValue(left.byteValue() - right.longValue());
1714                         }
1715                         break;
1716                 case T_short:
1717                         switch (rightId) {
1718                         case T_char:
1719                                 return Constant
1720                                                 .fromValue(left.shortValue() - right.charValue());
1721                         case T_float:
1722                                 return Constant.fromValue(left.shortValue()
1723                                                 - right.floatValue());
1724                         case T_double:
1725                                 return Constant.fromValue(left.shortValue()
1726                                                 - right.doubleValue());
1727                         case T_byte:
1728                                 return Constant
1729                                                 .fromValue(left.shortValue() - right.byteValue());
1730                         case T_short:
1731                                 return Constant.fromValue(left.shortValue()
1732                                                 - right.shortValue());
1733                         case T_int:
1734                                 return Constant.fromValue(left.shortValue() - right.intValue());
1735                         case T_long:
1736                                 return Constant
1737                                                 .fromValue(left.shortValue() - right.longValue());
1738                         }
1739                         break;
1740                 case T_int:
1741                         switch (rightId) {
1742                         case T_char:
1743                                 return Constant.fromValue(left.intValue() - right.charValue());
1744                         case T_float:
1745                                 return Constant.fromValue(left.intValue() - right.floatValue());
1746                         case T_double:
1747                                 return Constant
1748                                                 .fromValue(left.intValue() - right.doubleValue());
1749                         case T_byte:
1750                                 return Constant.fromValue(left.intValue() - right.byteValue());
1751                         case T_short:
1752                                 return Constant.fromValue(left.intValue() - right.shortValue());
1753                         case T_int:
1754                                 return Constant.fromValue(left.intValue() - right.intValue());
1755                         case T_long:
1756                                 return Constant.fromValue(left.intValue() - right.longValue());
1757                         }
1758                         break;
1759                 case T_long:
1760                         switch (rightId) {
1761                         case T_char:
1762                                 return Constant.fromValue(left.longValue() - right.charValue());
1763                         case T_float:
1764                                 return Constant
1765                                                 .fromValue(left.longValue() - right.floatValue());
1766                         case T_double:
1767                                 return Constant.fromValue(left.longValue()
1768                                                 - right.doubleValue());
1769                         case T_byte:
1770                                 return Constant.fromValue(left.longValue() - right.byteValue());
1771                         case T_short:
1772                                 return Constant
1773                                                 .fromValue(left.longValue() - right.shortValue());
1774                         case T_int:
1775                                 return Constant.fromValue(left.longValue() - right.intValue());
1776                         case T_long:
1777                                 return Constant.fromValue(left.longValue() - right.longValue());
1778                         }
1779
1780                 }
1781
1782                 return NotAConstant;
1783         }
1784
1785         public static final Constant computeConstantOperationMULTIPLY(
1786                         Constant left, int leftId, int operator, Constant right, int rightId) {
1787
1788                 switch (leftId) {
1789                 case T_char:
1790                         switch (rightId) {
1791                         case T_char:
1792                                 return Constant.fromValue(left.charValue() * right.charValue());
1793                         case T_float:
1794                                 return Constant
1795                                                 .fromValue(left.charValue() * right.floatValue());
1796                         case T_double:
1797                                 return Constant.fromValue(left.charValue()
1798                                                 * right.doubleValue());
1799                         case T_byte:
1800                                 return Constant.fromValue(left.charValue() * right.byteValue());
1801                         case T_short:
1802                                 return Constant
1803                                                 .fromValue(left.charValue() * right.shortValue());
1804                         case T_int:
1805                                 return Constant.fromValue(left.charValue() * right.intValue());
1806                         case T_long:
1807                                 return Constant.fromValue(left.charValue() * right.longValue());
1808                         }
1809                         break;
1810                 case T_float:
1811                         switch (rightId) {
1812                         case T_char:
1813                                 return Constant
1814                                                 .fromValue(left.floatValue() * right.charValue());
1815                         case T_float:
1816                                 return Constant.fromValue(left.floatValue()
1817                                                 * right.floatValue());
1818                         case T_double:
1819                                 return Constant.fromValue(left.floatValue()
1820                                                 * right.doubleValue());
1821                         case T_byte:
1822                                 return Constant
1823                                                 .fromValue(left.floatValue() * right.byteValue());
1824                         case T_short:
1825                                 return Constant.fromValue(left.floatValue()
1826                                                 * right.shortValue());
1827                         case T_int:
1828                                 return Constant.fromValue(left.floatValue() * right.intValue());
1829                         case T_long:
1830                                 return Constant
1831                                                 .fromValue(left.floatValue() * right.longValue());
1832                         }
1833                         break;
1834                 case T_double:
1835                         switch (rightId) {
1836                         case T_char:
1837                                 return Constant.fromValue(left.doubleValue()
1838                                                 * right.charValue());
1839                         case T_float:
1840                                 return Constant.fromValue(left.doubleValue()
1841                                                 * right.floatValue());
1842                         case T_double:
1843                                 return Constant.fromValue(left.doubleValue()
1844                                                 * right.doubleValue());
1845                         case T_byte:
1846                                 return Constant.fromValue(left.doubleValue()
1847                                                 * right.byteValue());
1848                         case T_short:
1849                                 return Constant.fromValue(left.doubleValue()
1850                                                 * right.shortValue());
1851                         case T_int:
1852                                 return Constant
1853                                                 .fromValue(left.doubleValue() * right.intValue());
1854                         case T_long:
1855                                 return Constant.fromValue(left.doubleValue()
1856                                                 * right.longValue());
1857                         }
1858                         break;
1859                 case T_byte:
1860                         switch (rightId) {
1861                         case T_char:
1862                                 return Constant.fromValue(left.byteValue() * right.charValue());
1863                         case T_float:
1864                                 return Constant
1865                                                 .fromValue(left.byteValue() * right.floatValue());
1866                         case T_double:
1867                                 return Constant.fromValue(left.byteValue()
1868                                                 * right.doubleValue());
1869                         case T_byte:
1870                                 return Constant.fromValue(left.byteValue() * right.byteValue());
1871                         case T_short:
1872                                 return Constant
1873                                                 .fromValue(left.byteValue() * right.shortValue());
1874                         case T_int:
1875                                 return Constant.fromValue(left.byteValue() * right.intValue());
1876                         case T_long:
1877                                 return Constant.fromValue(left.byteValue() * right.longValue());
1878                         }
1879                         break;
1880                 case T_short:
1881                         switch (rightId) {
1882                         case T_char:
1883                                 return Constant
1884                                                 .fromValue(left.shortValue() * right.charValue());
1885                         case T_float:
1886                                 return Constant.fromValue(left.shortValue()
1887                                                 * right.floatValue());
1888                         case T_double:
1889                                 return Constant.fromValue(left.shortValue()
1890                                                 * right.doubleValue());
1891                         case T_byte:
1892                                 return Constant
1893                                                 .fromValue(left.shortValue() * right.byteValue());
1894                         case T_short:
1895                                 return Constant.fromValue(left.shortValue()
1896                                                 * right.shortValue());
1897                         case T_int:
1898                                 return Constant.fromValue(left.shortValue() * right.intValue());
1899                         case T_long:
1900                                 return Constant
1901                                                 .fromValue(left.shortValue() * right.longValue());
1902                         }
1903                         break;
1904                 case T_int:
1905                         switch (rightId) {
1906                         case T_char:
1907                                 return Constant.fromValue(left.intValue() * right.charValue());
1908                         case T_float:
1909                                 return Constant.fromValue(left.intValue() * right.floatValue());
1910                         case T_double:
1911                                 return Constant
1912                                                 .fromValue(left.intValue() * right.doubleValue());
1913                         case T_byte:
1914                                 return Constant.fromValue(left.intValue() * right.byteValue());
1915                         case T_short:
1916                                 return Constant.fromValue(left.intValue() * right.shortValue());
1917                         case T_int:
1918                                 return Constant.fromValue(left.intValue() * right.intValue());
1919                         case T_long:
1920                                 return Constant.fromValue(left.intValue() * right.longValue());
1921                         }
1922                         break;
1923                 case T_long:
1924                         switch (rightId) {
1925                         case T_char:
1926                                 return Constant.fromValue(left.longValue() * right.charValue());
1927                         case T_float:
1928                                 return Constant
1929                                                 .fromValue(left.longValue() * right.floatValue());
1930                         case T_double:
1931                                 return Constant.fromValue(left.longValue()
1932                                                 * right.doubleValue());
1933                         case T_byte:
1934                                 return Constant.fromValue(left.longValue() * right.byteValue());
1935                         case T_short:
1936                                 return Constant
1937                                                 .fromValue(left.longValue() * right.shortValue());
1938                         case T_int:
1939                                 return Constant.fromValue(left.longValue() * right.intValue());
1940                         case T_long:
1941                                 return Constant.fromValue(left.longValue() * right.longValue());
1942                         }
1943                 }
1944
1945                 return NotAConstant;
1946         }
1947
1948         public static final Constant computeConstantOperationOR(Constant left,
1949                         int leftId, int operator, Constant right, int rightId) {
1950
1951                 switch (leftId) {
1952                 case T_boolean:
1953                         return Constant.fromValue(left.booleanValue()
1954                                         | right.booleanValue());
1955                 case T_char:
1956                         switch (rightId) {
1957                         case T_char:
1958                                 return Constant.fromValue(left.charValue() | right.charValue());
1959                         case T_byte:
1960                                 return Constant.fromValue(left.charValue() | right.byteValue());
1961                         case T_short:
1962                                 return Constant
1963                                                 .fromValue(left.charValue() | right.shortValue());
1964                         case T_int:
1965                                 return Constant.fromValue(left.charValue() | right.intValue());
1966                         case T_long:
1967                                 return Constant.fromValue(left.charValue() | right.longValue());
1968                         }
1969                         break;
1970                 case T_byte:
1971                         switch (rightId) {
1972                         case T_char:
1973                                 return Constant.fromValue(left.byteValue() | right.charValue());
1974                         case T_byte:
1975                                 return Constant.fromValue(left.byteValue() | right.byteValue());
1976                         case T_short:
1977                                 return Constant
1978                                                 .fromValue(left.byteValue() | right.shortValue());
1979                         case T_int:
1980                                 return Constant.fromValue(left.byteValue() | right.intValue());
1981                         case T_long:
1982                                 return Constant.fromValue(left.byteValue() | right.longValue());
1983                         }
1984                         break;
1985                 case T_short:
1986                         switch (rightId) {
1987                         case T_char:
1988                                 return Constant
1989                                                 .fromValue(left.shortValue() | right.charValue());
1990                         case T_byte:
1991                                 return Constant
1992                                                 .fromValue(left.shortValue() | right.byteValue());
1993                         case T_short:
1994                                 return Constant.fromValue(left.shortValue()
1995                                                 | right.shortValue());
1996                         case T_int:
1997                                 return Constant.fromValue(left.shortValue() | right.intValue());
1998                         case T_long:
1999                                 return Constant
2000                                                 .fromValue(left.shortValue() | right.longValue());
2001                         }
2002                         break;
2003                 case T_int:
2004                         switch (rightId) {
2005                         case T_char:
2006                                 return Constant.fromValue(left.intValue() | right.charValue());
2007                         case T_byte:
2008                                 return Constant.fromValue(left.intValue() | right.byteValue());
2009                         case T_short:
2010                                 return Constant.fromValue(left.intValue() | right.shortValue());
2011                         case T_int:
2012                                 return Constant.fromValue(left.intValue() | right.intValue());
2013                         case T_long:
2014                                 return Constant.fromValue(left.intValue() | right.longValue());
2015                         }
2016                         break;
2017                 case T_long:
2018                         switch (rightId) {
2019                         case T_char:
2020                                 return Constant.fromValue(left.longValue() | right.charValue());
2021                         case T_byte:
2022                                 return Constant.fromValue(left.longValue() | right.byteValue());
2023                         case T_short:
2024                                 return Constant
2025                                                 .fromValue(left.longValue() | right.shortValue());
2026                         case T_int:
2027                                 return Constant.fromValue(left.longValue() | right.intValue());
2028                         case T_long:
2029                                 return Constant.fromValue(left.longValue() | right.longValue());
2030                         }
2031
2032                 }
2033
2034                 return NotAConstant;
2035         }
2036
2037         public static final Constant computeConstantOperationOR_OR(Constant left,
2038                         int leftId, int operator, Constant right, int rightId) {
2039
2040                 return Constant.fromValue(left.booleanValue() || right.booleanValue());
2041         }
2042
2043         public static final Constant computeConstantOperationPLUS(Constant left,
2044                         int leftId, int operator, Constant right, int rightId) {
2045
2046                 switch (leftId) {
2047                 case T_Object:
2048                         if (rightId == T_String) {
2049                                 return Constant.fromValue(left.stringValue()
2050                                                 + right.stringValue());
2051                         }
2052                 case T_boolean:
2053                         if (rightId == T_String) {
2054                                 return Constant.fromValue(left.stringValue()
2055                                                 + right.stringValue());
2056                         }
2057                         break;
2058                 case T_char:
2059                         switch (rightId) {
2060                         case T_char:
2061                                 return Constant.fromValue(left.charValue() + right.charValue());
2062                         case T_float:
2063                                 return Constant
2064                                                 .fromValue(left.charValue() + right.floatValue());
2065                         case T_double:
2066                                 return Constant.fromValue(left.charValue()
2067                                                 + right.doubleValue());
2068                         case T_byte:
2069                                 return Constant.fromValue(left.charValue() + right.byteValue());
2070                         case T_short:
2071                                 return Constant
2072                                                 .fromValue(left.charValue() + right.shortValue());
2073                         case T_int:
2074                                 return Constant.fromValue(left.charValue() + right.intValue());
2075                         case T_long:
2076                                 return Constant.fromValue(left.charValue() + right.longValue());
2077                         case T_String:
2078                                 return Constant.fromValue(left.stringValue()
2079                                                 + right.stringValue());
2080                         }
2081                         break;
2082                 case T_float:
2083                         switch (rightId) {
2084                         case T_char:
2085                                 return Constant
2086                                                 .fromValue(left.floatValue() + right.charValue());
2087                         case T_float:
2088                                 return Constant.fromValue(left.floatValue()
2089                                                 + right.floatValue());
2090                         case T_double:
2091                                 return Constant.fromValue(left.floatValue()
2092                                                 + right.doubleValue());
2093                         case T_byte:
2094                                 return Constant
2095                                                 .fromValue(left.floatValue() + right.byteValue());
2096                         case T_short:
2097                                 return Constant.fromValue(left.floatValue()
2098                                                 + right.shortValue());
2099                         case T_int:
2100                                 return Constant.fromValue(left.floatValue() + right.intValue());
2101                         case T_long:
2102                                 return Constant
2103                                                 .fromValue(left.floatValue() + right.longValue());
2104                         case T_String:
2105                                 return Constant.fromValue(left.stringValue()
2106                                                 + right.stringValue());
2107                         }
2108                         break;
2109                 case T_double:
2110                         switch (rightId) {
2111                         case T_char:
2112                                 return Constant.fromValue(left.doubleValue()
2113                                                 + right.charValue());
2114                         case T_float:
2115                                 return Constant.fromValue(left.doubleValue()
2116                                                 + right.floatValue());
2117                         case T_double:
2118                                 return Constant.fromValue(left.doubleValue()
2119                                                 + right.doubleValue());
2120                         case T_byte:
2121                                 return Constant.fromValue(left.doubleValue()
2122                                                 + right.byteValue());
2123                         case T_short:
2124                                 return Constant.fromValue(left.doubleValue()
2125                                                 + right.shortValue());
2126                         case T_int:
2127                                 return Constant
2128                                                 .fromValue(left.doubleValue() + right.intValue());
2129                         case T_long:
2130                                 return Constant.fromValue(left.doubleValue()
2131                                                 + right.longValue());
2132                         case T_String:
2133                                 return Constant.fromValue(left.stringValue()
2134                                                 + right.stringValue());
2135                         }
2136                         break;
2137                 case T_byte:
2138                         switch (rightId) {
2139                         case T_char:
2140                                 return Constant.fromValue(left.byteValue() + right.charValue());
2141                         case T_float:
2142                                 return Constant
2143                                                 .fromValue(left.byteValue() + right.floatValue());
2144                         case T_double:
2145                                 return Constant.fromValue(left.byteValue()
2146                                                 + right.doubleValue());
2147                         case T_byte:
2148                                 return Constant.fromValue(left.byteValue() + right.byteValue());
2149                         case T_short:
2150                                 return Constant
2151                                                 .fromValue(left.byteValue() + right.shortValue());
2152                         case T_int:
2153                                 return Constant.fromValue(left.byteValue() + right.intValue());
2154                         case T_long:
2155                                 return Constant.fromValue(left.byteValue() + right.longValue());
2156                         case T_String:
2157                                 return Constant.fromValue(left.stringValue()
2158                                                 + right.stringValue());
2159                         }
2160
2161                         break;
2162                 case T_short:
2163                         switch (rightId) {
2164                         case T_char:
2165                                 return Constant
2166                                                 .fromValue(left.shortValue() + right.charValue());
2167                         case T_float:
2168                                 return Constant.fromValue(left.shortValue()
2169                                                 + right.floatValue());
2170                         case T_double:
2171                                 return Constant.fromValue(left.shortValue()
2172                                                 + right.doubleValue());
2173                         case T_byte:
2174                                 return Constant
2175                                                 .fromValue(left.shortValue() + right.byteValue());
2176                         case T_short:
2177                                 return Constant.fromValue(left.shortValue()
2178                                                 + right.shortValue());
2179                         case T_int:
2180                                 return Constant.fromValue(left.shortValue() + right.intValue());
2181                         case T_long:
2182                                 return Constant
2183                                                 .fromValue(left.shortValue() + right.longValue());
2184                         case T_String:
2185                                 return Constant.fromValue(left.stringValue()
2186                                                 + right.stringValue());
2187                         }
2188                         break;
2189                 case T_int:
2190                         switch (rightId) {
2191                         case T_char:
2192                                 return Constant.fromValue(left.intValue() + right.charValue());
2193                         case T_float:
2194                                 return Constant.fromValue(left.intValue() + right.floatValue());
2195                         case T_double:
2196                                 return Constant
2197                                                 .fromValue(left.intValue() + right.doubleValue());
2198                         case T_byte:
2199                                 return Constant.fromValue(left.intValue() + right.byteValue());
2200                         case T_short:
2201                                 return Constant.fromValue(left.intValue() + right.shortValue());
2202                         case T_int:
2203                                 return Constant.fromValue(left.intValue() + right.intValue());
2204                         case T_long:
2205                                 return Constant.fromValue(left.intValue() + right.longValue());
2206                         case T_String:
2207                                 return Constant.fromValue(left.stringValue()
2208                                                 + right.stringValue());
2209                         }
2210                         break;
2211                 case T_long:
2212                         switch (rightId) {
2213                         case T_char:
2214                                 return Constant.fromValue(left.longValue() + right.charValue());
2215                         case T_float:
2216                                 return Constant
2217                                                 .fromValue(left.longValue() + right.floatValue());
2218                         case T_double:
2219                                 return Constant.fromValue(left.longValue()
2220                                                 + right.doubleValue());
2221                         case T_byte:
2222                                 return Constant.fromValue(left.longValue() + right.byteValue());
2223                         case T_short:
2224                                 return Constant
2225                                                 .fromValue(left.longValue() + right.shortValue());
2226                         case T_int:
2227                                 return Constant.fromValue(left.longValue() + right.intValue());
2228                         case T_long:
2229                                 return Constant.fromValue(left.longValue() + right.longValue());
2230                         case T_String:
2231                                 return Constant.fromValue(left.stringValue()
2232                                                 + right.stringValue());
2233                         }
2234                         break;
2235                 case T_String:
2236                         switch (rightId) {
2237                         case T_char:
2238                                 return Constant.fromValue(left.stringValue()
2239                                                 + right.stringValue());
2240                         case T_float:
2241                                 return Constant.fromValue(left.stringValue()
2242                                                 + right.stringValue());
2243                         case T_double:
2244                                 return Constant.fromValue(left.stringValue()
2245                                                 + right.stringValue());
2246                         case T_byte:
2247                                 return Constant.fromValue(left.stringValue()
2248                                                 + right.stringValue());
2249                         case T_short:
2250                                 return Constant.fromValue(left.stringValue()
2251                                                 + right.stringValue());
2252                         case T_int:
2253                                 return Constant.fromValue(left.stringValue()
2254                                                 + right.stringValue());
2255                         case T_long:
2256                                 return Constant.fromValue(left.stringValue()
2257                                                 + right.stringValue());
2258                         case T_String:
2259                                 return Constant.fromValue(left.stringValue()
2260                                                 + right.stringValue());
2261                         case T_boolean:
2262                                 return Constant.fromValue(left.stringValue()
2263                                                 + right.stringValue());
2264                         }
2265                         break;
2266                 case T_null:
2267                         switch (rightId) {
2268                         case T_char:
2269                                 return Constant.fromValue(left.stringValue()
2270                                                 + right.stringValue());
2271                         case T_float:
2272                                 return Constant.fromValue(left.stringValue()
2273                                                 + right.stringValue());
2274                         case T_double:
2275                                 return Constant.fromValue(left.stringValue()
2276                                                 + right.stringValue());
2277                         case T_byte:
2278                                 return Constant.fromValue(left.stringValue()
2279                                                 + right.stringValue());
2280                         case T_short:
2281                                 return Constant.fromValue(left.stringValue()
2282                                                 + right.stringValue());
2283                         case T_int:
2284                                 return Constant.fromValue(left.stringValue()
2285                                                 + right.stringValue());
2286                         case T_long:
2287                                 return Constant.fromValue(left.stringValue()
2288                                                 + right.stringValue());
2289                         case T_String:
2290                                 return Constant.fromValue(left.stringValue()
2291                                                 + right.stringValue());
2292                         }
2293
2294                 }
2295
2296                 return NotAConstant;
2297         }
2298
2299         public static final Constant computeConstantOperationREMAINDER(
2300                         Constant left, int leftId, int operator, Constant right, int rightId) {
2301
2302                 switch (leftId) {
2303                 case T_char:
2304                         switch (rightId) {
2305                         case T_char:
2306                                 return Constant.fromValue(left.charValue() % right.charValue());
2307                         case T_float:
2308                                 return Constant
2309                                                 .fromValue(left.charValue() % right.floatValue());
2310                         case T_double:
2311                                 return Constant.fromValue(left.charValue()
2312                                                 % right.doubleValue());
2313                         case T_byte:
2314                                 return Constant.fromValue(left.charValue() % right.byteValue());
2315                         case T_short:
2316                                 return Constant
2317                                                 .fromValue(left.charValue() % right.shortValue());
2318                         case T_int:
2319                                 return Constant.fromValue(left.charValue() % right.intValue());
2320                         case T_long:
2321                                 return Constant.fromValue(left.charValue() % right.longValue());
2322                         }
2323                         break;
2324                 case T_float:
2325                         switch (rightId) {
2326                         case T_char:
2327                                 return Constant
2328                                                 .fromValue(left.floatValue() % right.charValue());
2329                         case T_float:
2330                                 return Constant.fromValue(left.floatValue()
2331                                                 % right.floatValue());
2332                         case T_double:
2333                                 return Constant.fromValue(left.floatValue()
2334                                                 % right.doubleValue());
2335                         case T_byte:
2336                                 return Constant
2337                                                 .fromValue(left.floatValue() % right.byteValue());
2338                         case T_short:
2339                                 return Constant.fromValue(left.floatValue()
2340                                                 % right.shortValue());
2341                         case T_int:
2342                                 return Constant.fromValue(left.floatValue() % right.intValue());
2343                         case T_long:
2344                                 return Constant
2345                                                 .fromValue(left.floatValue() % right.longValue());
2346                         }
2347                         break;
2348                 case T_double:
2349                         switch (rightId) {
2350                         case T_char:
2351                                 return Constant.fromValue(left.doubleValue()
2352                                                 % right.charValue());
2353                         case T_float:
2354                                 return Constant.fromValue(left.doubleValue()
2355                                                 % right.floatValue());
2356                         case T_double:
2357                                 return Constant.fromValue(left.doubleValue()
2358                                                 % right.doubleValue());
2359                         case T_byte:
2360                                 return Constant.fromValue(left.doubleValue()
2361                                                 % right.byteValue());
2362                         case T_short:
2363                                 return Constant.fromValue(left.doubleValue()
2364                                                 % right.shortValue());
2365                         case T_int:
2366                                 return Constant
2367                                                 .fromValue(left.doubleValue() % right.intValue());
2368                         case T_long:
2369                                 return Constant.fromValue(left.doubleValue()
2370                                                 % right.longValue());
2371                         }
2372                         break;
2373                 case T_byte:
2374                         switch (rightId) {
2375                         case T_char:
2376                                 return Constant.fromValue(left.byteValue() % right.charValue());
2377                         case T_float:
2378                                 return Constant
2379                                                 .fromValue(left.byteValue() % right.floatValue());
2380                         case T_double:
2381                                 return Constant.fromValue(left.byteValue()
2382                                                 % right.doubleValue());
2383                         case T_byte:
2384                                 return Constant.fromValue(left.byteValue() % right.byteValue());
2385                         case T_short:
2386                                 return Constant
2387                                                 .fromValue(left.byteValue() % right.shortValue());
2388                         case T_int:
2389                                 return Constant.fromValue(left.byteValue() % right.intValue());
2390                         case T_long:
2391                                 return Constant.fromValue(left.byteValue() % right.longValue());
2392                         }
2393                         break;
2394                 case T_short:
2395                         switch (rightId) {
2396                         case T_char:
2397                                 return Constant
2398                                                 .fromValue(left.shortValue() % right.charValue());
2399                         case T_float:
2400                                 return Constant.fromValue(left.shortValue()
2401                                                 % right.floatValue());
2402                         case T_double:
2403                                 return Constant.fromValue(left.shortValue()
2404                                                 % right.doubleValue());
2405                         case T_byte:
2406                                 return Constant
2407                                                 .fromValue(left.shortValue() % right.byteValue());
2408                         case T_short:
2409                                 return Constant.fromValue(left.shortValue()
2410                                                 % right.shortValue());
2411                         case T_int:
2412                                 return Constant.fromValue(left.shortValue() % right.intValue());
2413                         case T_long:
2414                                 return Constant
2415                                                 .fromValue(left.shortValue() % right.longValue());
2416                         }
2417                         break;
2418                 case T_int:
2419                         switch (rightId) {
2420                         case T_char:
2421                                 return Constant.fromValue(left.intValue() % right.charValue());
2422                         case T_float:
2423                                 return Constant.fromValue(left.intValue() % right.floatValue());
2424                         case T_double:
2425                                 return Constant
2426                                                 .fromValue(left.intValue() % right.doubleValue());
2427                         case T_byte:
2428                                 return Constant.fromValue(left.intValue() % right.byteValue());
2429                         case T_short:
2430                                 return Constant.fromValue(left.intValue() % right.shortValue());
2431                         case T_int:
2432                                 return Constant.fromValue(left.intValue() % right.intValue());
2433                         case T_long:
2434                                 return Constant.fromValue(left.intValue() % right.longValue());
2435                         }
2436                         break;
2437                 case T_long:
2438                         switch (rightId) {
2439                         case T_char:
2440                                 return Constant.fromValue(left.longValue() % right.charValue());
2441                         case T_float:
2442                                 return Constant
2443                                                 .fromValue(left.longValue() % right.floatValue());
2444                         case T_double:
2445                                 return Constant.fromValue(left.longValue()
2446                                                 % right.doubleValue());
2447                         case T_byte:
2448                                 return Constant.fromValue(left.longValue() % right.byteValue());
2449                         case T_short:
2450                                 return Constant
2451                                                 .fromValue(left.longValue() % right.shortValue());
2452                         case T_int:
2453                                 return Constant.fromValue(left.longValue() % right.intValue());
2454                         case T_long:
2455                                 return Constant.fromValue(left.longValue() % right.longValue());
2456                         }
2457
2458                 }
2459
2460                 return NotAConstant;
2461         }
2462
2463         public static final Constant computeConstantOperationRIGHT_SHIFT(
2464                         Constant left, int leftId, int operator, Constant right, int rightId) {
2465
2466                 switch (leftId) {
2467                 case T_char:
2468                         switch (rightId) {
2469                         case T_char:
2470                                 return Constant
2471                                                 .fromValue(left.charValue() >> right.charValue());
2472                         case T_byte:
2473                                 return Constant
2474                                                 .fromValue(left.charValue() >> right.byteValue());
2475                         case T_short:
2476                                 return Constant.fromValue(left.charValue() >> right
2477                                                 .shortValue());
2478                         case T_int:
2479                                 return Constant.fromValue(left.charValue() >> right.intValue());
2480                         case T_long:
2481                                 return Constant
2482                                                 .fromValue(left.charValue() >> right.longValue());
2483                         }
2484                         break;
2485                 case T_byte:
2486                         switch (rightId) {
2487                         case T_char:
2488                                 return Constant
2489                                                 .fromValue(left.byteValue() >> right.charValue());
2490                         case T_byte:
2491                                 return Constant
2492                                                 .fromValue(left.byteValue() >> right.byteValue());
2493                         case T_short:
2494                                 return Constant.fromValue(left.byteValue() >> right
2495                                                 .shortValue());
2496                         case T_int:
2497                                 return Constant.fromValue(left.byteValue() >> right.intValue());
2498                         case T_long:
2499                                 return Constant
2500                                                 .fromValue(left.byteValue() >> right.longValue());
2501                         }
2502                         break;
2503                 case T_short:
2504                         switch (rightId) {
2505                         case T_char:
2506                                 return Constant.fromValue(left.shortValue() >> right
2507                                                 .charValue());
2508                         case T_byte:
2509                                 return Constant.fromValue(left.shortValue() >> right
2510                                                 .byteValue());
2511                         case T_short:
2512                                 return Constant.fromValue(left.shortValue() >> right
2513                                                 .shortValue());
2514                         case T_int:
2515                                 return Constant
2516                                                 .fromValue(left.shortValue() >> right.intValue());
2517                         case T_long:
2518                                 return Constant.fromValue(left.shortValue() >> right
2519                                                 .longValue());
2520                         }
2521                         break;
2522                 case T_int:
2523                         switch (rightId) {
2524                         case T_char:
2525                                 return Constant.fromValue(left.intValue() >> right.charValue());
2526                         case T_byte:
2527                                 return Constant.fromValue(left.intValue() >> right.byteValue());
2528                         case T_short:
2529                                 return Constant
2530                                                 .fromValue(left.intValue() >> right.shortValue());
2531                         case T_int:
2532                                 return Constant.fromValue(left.intValue() >> right.intValue());
2533                         case T_long:
2534                                 return Constant.fromValue(left.intValue() >> right.longValue());
2535                         }
2536                         break;
2537                 case T_long:
2538                         switch (rightId) {
2539                         case T_char:
2540                                 return Constant
2541                                                 .fromValue(left.longValue() >> right.charValue());
2542                         case T_byte:
2543                                 return Constant
2544                                                 .fromValue(left.longValue() >> right.byteValue());
2545                         case T_short:
2546                                 return Constant.fromValue(left.longValue() >> right
2547                                                 .shortValue());
2548                         case T_int:
2549                                 return Constant.fromValue(left.longValue() >> right.intValue());
2550                         case T_long:
2551                                 return Constant
2552                                                 .fromValue(left.longValue() >> right.longValue());
2553                         }
2554
2555                 }
2556
2557                 return NotAConstant;
2558         }
2559
2560         public static final Constant computeConstantOperationUNSIGNED_RIGHT_SHIFT(
2561                         Constant left, int leftId, int operator, Constant right, int rightId) {
2562
2563                 switch (leftId) {
2564                 case T_char:
2565                         switch (rightId) {
2566                         case T_char:
2567                                 return Constant.fromValue(left.charValue() >>> right
2568                                                 .charValue());
2569                         case T_byte:
2570                                 return Constant.fromValue(left.charValue() >>> right
2571                                                 .byteValue());
2572                         case T_short:
2573                                 return Constant.fromValue(left.charValue() >>> right
2574                                                 .shortValue());
2575                         case T_int:
2576                                 return Constant
2577                                                 .fromValue(left.charValue() >>> right.intValue());
2578                         case T_long:
2579                                 return Constant.fromValue(left.charValue() >>> right
2580                                                 .longValue());
2581                         }
2582                         break;
2583                 case T_byte:
2584                         switch (rightId) {
2585                         case T_char:
2586                                 return Constant.fromValue(left.byteValue() >>> right
2587                                                 .charValue());
2588                         case T_byte:
2589                                 return Constant.fromValue(left.byteValue() >>> right
2590                                                 .byteValue());
2591                         case T_short:
2592                                 return Constant.fromValue(left.byteValue() >>> right
2593                                                 .shortValue());
2594                         case T_int:
2595                                 return Constant
2596                                                 .fromValue(left.byteValue() >>> right.intValue());
2597                         case T_long:
2598                                 return Constant.fromValue(left.byteValue() >>> right
2599                                                 .longValue());
2600                         }
2601                         break;
2602                 case T_short:
2603                         switch (rightId) {
2604                         case T_char:
2605                                 return Constant.fromValue(left.shortValue() >>> right
2606                                                 .charValue());
2607                         case T_byte:
2608                                 return Constant.fromValue(left.shortValue() >>> right
2609                                                 .byteValue());
2610                         case T_short:
2611                                 return Constant.fromValue(left.shortValue() >>> right
2612                                                 .shortValue());
2613                         case T_int:
2614                                 return Constant.fromValue(left.shortValue() >>> right
2615                                                 .intValue());
2616                         case T_long:
2617                                 return Constant.fromValue(left.shortValue() >>> right
2618                                                 .longValue());
2619                         }
2620                         break;
2621                 case T_int:
2622                         switch (rightId) {
2623                         case T_char:
2624                                 return Constant
2625                                                 .fromValue(left.intValue() >>> right.charValue());
2626                         case T_byte:
2627                                 return Constant
2628                                                 .fromValue(left.intValue() >>> right.byteValue());
2629                         case T_short:
2630                                 return Constant.fromValue(left.intValue() >>> right
2631                                                 .shortValue());
2632                         case T_int:
2633                                 return Constant.fromValue(left.intValue() >>> right.intValue());
2634                         case T_long:
2635                                 return Constant
2636                                                 .fromValue(left.intValue() >>> right.longValue());
2637                         }
2638                         break;
2639                 case T_long:
2640                         switch (rightId) {
2641                         case T_char:
2642                                 return Constant.fromValue(left.longValue() >>> right
2643                                                 .charValue());
2644                         case T_byte:
2645                                 return Constant.fromValue(left.longValue() >>> right
2646                                                 .byteValue());
2647                         case T_short:
2648                                 return Constant.fromValue(left.longValue() >>> right
2649                                                 .shortValue());
2650                         case T_int:
2651                                 return Constant
2652                                                 .fromValue(left.longValue() >>> right.intValue());
2653                         case T_long:
2654                                 return Constant.fromValue(left.longValue() >>> right
2655                                                 .longValue());
2656                         }
2657
2658                 }
2659
2660                 return NotAConstant;
2661         }
2662
2663         public static final Constant computeConstantOperationXOR(Constant left,
2664                         int leftId, int operator, Constant right, int rightId) {
2665
2666                 switch (leftId) {
2667                 case T_boolean:
2668                         return Constant.fromValue(left.booleanValue()
2669                                         ^ right.booleanValue());
2670                 case T_char:
2671                         switch (rightId) {
2672                         case T_char:
2673                                 return Constant.fromValue(left.charValue() ^ right.charValue());
2674                         case T_byte:
2675                                 return Constant.fromValue(left.charValue() ^ right.byteValue());
2676                         case T_short:
2677                                 return Constant
2678                                                 .fromValue(left.charValue() ^ right.shortValue());
2679                         case T_int:
2680                                 return Constant.fromValue(left.charValue() ^ right.intValue());
2681                         case T_long:
2682                                 return Constant.fromValue(left.charValue() ^ right.longValue());
2683                         }
2684                         break;
2685                 case T_byte:
2686                         switch (rightId) {
2687                         case T_char:
2688                                 return Constant.fromValue(left.byteValue() ^ right.charValue());
2689                         case T_byte:
2690                                 return Constant.fromValue(left.byteValue() ^ right.byteValue());
2691                         case T_short:
2692                                 return Constant
2693                                                 .fromValue(left.byteValue() ^ right.shortValue());
2694                         case T_int:
2695                                 return Constant.fromValue(left.byteValue() ^ right.intValue());
2696                         case T_long:
2697                                 return Constant.fromValue(left.byteValue() ^ right.longValue());
2698                         }
2699                         break;
2700                 case T_short:
2701                         switch (rightId) {
2702                         case T_char:
2703                                 return Constant
2704                                                 .fromValue(left.shortValue() ^ right.charValue());
2705                         case T_byte:
2706                                 return Constant
2707                                                 .fromValue(left.shortValue() ^ right.byteValue());
2708                         case T_short:
2709                                 return Constant.fromValue(left.shortValue()
2710                                                 ^ right.shortValue());
2711                         case T_int:
2712                                 return Constant.fromValue(left.shortValue() ^ right.intValue());
2713                         case T_long:
2714                                 return Constant
2715                                                 .fromValue(left.shortValue() ^ right.longValue());
2716                         }
2717                         break;
2718                 case T_int:
2719                         switch (rightId) {
2720                         case T_char:
2721                                 return Constant.fromValue(left.intValue() ^ right.charValue());
2722                         case T_byte:
2723                                 return Constant.fromValue(left.intValue() ^ right.byteValue());
2724                         case T_short:
2725                                 return Constant.fromValue(left.intValue() ^ right.shortValue());
2726                         case T_int:
2727                                 return Constant.fromValue(left.intValue() ^ right.intValue());
2728                         case T_long:
2729                                 return Constant.fromValue(left.intValue() ^ right.longValue());
2730                         }
2731                         break;
2732                 case T_long:
2733                         switch (rightId) {
2734                         case T_char:
2735                                 return Constant.fromValue(left.longValue() ^ right.charValue());
2736                         case T_byte:
2737                                 return Constant.fromValue(left.longValue() ^ right.byteValue());
2738                         case T_short:
2739                                 return Constant
2740                                                 .fromValue(left.longValue() ^ right.shortValue());
2741                         case T_int:
2742                                 return Constant.fromValue(left.longValue() ^ right.intValue());
2743                         case T_long:
2744                                 return Constant.fromValue(left.longValue() ^ right.longValue());
2745                         }
2746                 }
2747
2748                 return NotAConstant;
2749         }
2750
2751         public double doubleValue() {
2752
2753                 throw new ShouldNotImplement(Util.bind(
2754                                 "constant.cannotCastedInto", typeName(), "double")); //$NON-NLS-2$ //$NON-NLS-1$
2755         }
2756
2757         public float floatValue() {
2758
2759                 throw new ShouldNotImplement(Util.bind(
2760                                 "constant.cannotCastedInto", typeName(), "float")); //$NON-NLS-2$ //$NON-NLS-1$
2761         }
2762
2763         // public static Constant fromValue(byte value) {
2764         //
2765         // return new ByteConstant(value);
2766         // }
2767
2768         // public static Constant fromValue(char value) {
2769         //
2770         // return new CharConstant(value);
2771         // }
2772
2773         public static Constant fromValue(double value) {
2774
2775                 return new DoubleConstant(value);
2776         }
2777
2778         // public static Constant fromValue(float value) {
2779         //
2780         // return new FloatConstant(value);
2781         // }
2782
2783         public static Constant fromValue(int value) {
2784
2785                 return new IntConstant(value);
2786         }
2787
2788         // public static Constant fromValue(long value) {
2789         //
2790         // return new LongConstant(value);
2791         // }
2792
2793         public static Constant fromValue(String value) {
2794
2795                 return new StringConstant(value);
2796         }
2797
2798         // public static Constant fromValue(short value) {
2799         //
2800         // return new ShortConstant(value);
2801         // }
2802
2803         public static Constant fromValue(boolean value) {
2804
2805                 return new BooleanConstant(value);
2806         }
2807
2808         public int intValue() {
2809
2810                 throw new ShouldNotImplement(Util.bind(
2811                                 "constant.cannotCastedInto", typeName(), "int")); //$NON-NLS-2$ //$NON-NLS-1$
2812         }
2813
2814         public long longValue() {
2815
2816                 throw new ShouldNotImplement(Util.bind(
2817                                 "constant.cannotCastedInto", typeName(), "long")); //$NON-NLS-2$ //$NON-NLS-1$
2818         }
2819
2820         public short shortValue() {
2821
2822                 throw new ShouldNotImplement(Util.bind(
2823                                 "constant.cannotConvertedTo", typeName(), "short")); //$NON-NLS-2$ //$NON-NLS-1$
2824         }
2825
2826         public String stringValue() {
2827
2828                 throw new ShouldNotImplement(Util.bind(
2829                                 "constant.cannotConvertedTo", typeName(), "String")); //$NON-NLS-1$ //$NON-NLS-2$
2830         }
2831
2832         public String toString() {
2833
2834                 if (this == NotAConstant)
2835                         return "(Constant) NotAConstant"; //$NON-NLS-1$
2836                 return super.toString();
2837         }
2838
2839         public abstract int typeID();
2840
2841         public String typeName() {
2842                 switch (typeID()) {
2843                 case T_int:
2844                         return "int"; //$NON-NLS-1$
2845                 case T_byte:
2846                         return "byte"; //$NON-NLS-1$
2847                 case T_short:
2848                         return "short"; //$NON-NLS-1$
2849                 case T_char:
2850                         return "char"; //$NON-NLS-1$
2851                 case T_float:
2852                         return "float"; //$NON-NLS-1$
2853                 case T_double:
2854                         return "double"; //$NON-NLS-1$
2855                 case T_boolean:
2856                         return "boolean"; //$NON-NLS-1$
2857                 case T_long:
2858                         return "long";//$NON-NLS-1$
2859                 case T_String:
2860                         return "java.lang.String"; //$NON-NLS-1$
2861                 case T_null:
2862                         return "null"; //$NON-NLS-1$
2863                 default:
2864                         return "unknown"; //$NON-NLS-1$
2865                 }
2866         }
2867 }