added -J option to preserve unmodified files in preexisting jarfile
[org.ibex.tool.git] / src / org / eclipse / jdt / internal / compiler / impl / Constant.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 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 org.eclipse.jdt.internal.compiler.impl;
12
13 import org.eclipse.jdt.internal.compiler.ast.OperatorIds;
14 import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
15 import org.eclipse.jdt.internal.compiler.problem.ShouldNotImplement;
16 import org.eclipse.jdt.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         public static final IntConstant Two = new IntConstant(2);
24         public static final IntConstant One = new IntConstant(1);
25         
26         public boolean booleanValue() {
27
28                 throw new ShouldNotImplement(Util.bind("constant.cannotCastedInto",typeName(),"boolean")); //$NON-NLS-1$ //$NON-NLS-2$
29         }
30
31         public byte byteValue() {
32
33                 throw new ShouldNotImplement(Util.bind("constant.cannotCastedInto",typeName(),"byte")); //$NON-NLS-1$ //$NON-NLS-2$
34         }
35
36         public final Constant castTo(int conversionToTargetType){
37                 //the cast is an int of the form
38                 // (castId<<4)+typeId (in order to follow the
39                 //user written style (cast)expression ....
40         
41                 if (this == NotAConstant) return NotAConstant;
42                 switch(conversionToTargetType){
43                         case T_undefined :                                              return this;
44         //            TARGET TYPE  <- FROM TYPE
45         //          case (T_undefined<<4)+T_undefined    : return NotAConstant;  
46         //          case (T_undefined<<4)+T_byte                 : return NotAConstant;   
47         //          case (T_undefined<<4)+T_long                 : return NotAConstant;   
48         //          case (T_undefined<<4)+T_short                : return NotAConstant;   
49         //          case (T_undefined<<4)+T_void                 : return NotAConstant;   
50         //          case (T_undefined<<4)+T_String       : return NotAConstant;   
51         //          case (T_undefined<<4)+T_Object       : return NotAConstant;   
52         //          case (T_undefined<<4)+T_double       : return NotAConstant;   
53         //          case (T_undefined<<4)+T_float                : return NotAConstant;   
54         //          case (T_undefined<<4)+T_boolean      : return NotAConstant;   
55         //          case (T_undefined<<4)+T_char                 : return NotAConstant;   
56         //          case (T_undefined<<4)+T_int                  : return NotAConstant;   
57                 
58         //          case (T_byte<<4)+T_undefined         : return NotAConstant;   
59                     case (T_byte<<4)+T_byte              : return this;  
60                     case (T_byte<<4)+T_long              : return Constant.fromValue((byte)this.longValue()); 
61                     case (T_byte<<4)+T_short             : return Constant.fromValue((byte)this.shortValue());    
62         //          case (T_byte<<4)+T_void              : return NotAConstant;   
63         //          case (T_byte<<4)+T_String            : return NotAConstant;   
64         //          case (T_byte<<4)+T_Object            : return NotAConstant;   
65                     case (T_byte<<4)+T_double            : return Constant.fromValue((byte)this.doubleValue());    
66                     case (T_byte<<4)+T_float             : return Constant.fromValue((byte)this.floatValue());    
67         //          case (T_byte<<4)+T_boolean           : return NotAConstant;   
68                     case (T_byte<<4)+T_char              : return Constant.fromValue((byte)this.charValue());    
69                     case (T_byte<<4)+T_int               : return Constant.fromValue((byte)this.intValue());    
70         
71         //          case (T_long<<4)+T_undefined         : return NotAConstant;   
72                     case (T_long<<4)+T_byte              : return Constant.fromValue((long)this.byteValue()); 
73                     case (T_long<<4)+T_long              : return this; 
74                     case (T_long<<4)+T_short             : return Constant.fromValue((long)this.shortValue()); 
75         //          case (T_long<<4)+T_void              : return NotAConstant;   
76         //          case (T_long<<4)+T_String            : return NotAConstant;   
77         //          case (T_long<<4)+T_Object            : return NotAConstant;   
78                     case (T_long<<4)+T_double            : return Constant.fromValue((long)this.doubleValue());   
79                     case (T_long<<4)+T_float             : return Constant.fromValue((long)this.floatValue());  
80         //          case (T_long<<4)+T_boolean           : return NotAConstant;   
81                     case (T_long<<4)+T_char              : return Constant.fromValue((long)this.charValue()); 
82                     case (T_long<<4)+T_int               : return Constant.fromValue((long)this.intValue()); 
83         
84         //          case (T_short<<4)+T_undefined        : return NotAConstant;   
85                     case (T_short<<4)+T_byte             : return Constant.fromValue((short)this.byteValue());
86                     case (T_short<<4)+T_long             : return Constant.fromValue((short)this.longValue()); 
87                     case (T_short<<4)+T_short            : return this;  
88         //          case (T_short<<4)+T_void             : return NotAConstant;   
89         //          case (T_short<<4)+T_String           : return NotAConstant;   
90         //          case (T_short<<4)+T_Object           : return NotAConstant;   
91                     case (T_short<<4)+T_double           : return Constant.fromValue((short)this.doubleValue());   
92                     case (T_short<<4)+T_float            : return Constant.fromValue((short)this.floatValue());   
93         //          case (T_short<<4)+T_boolean          : return NotAConstant;   
94                     case (T_short<<4)+T_char             : return Constant.fromValue((short)this.charValue());  
95                     case (T_short<<4)+T_int              : return Constant.fromValue((short)this.intValue());  
96         
97         //          case (T_void<<4)+T_undefined         : return NotAConstant;   
98         //          case (T_void<<4)+T_byte              : return NotAConstant;   
99         //          case (T_void<<4)+T_long              : return NotAConstant;   
100         //          case (T_void<<4)+T_short             : return NotAConstant;   
101         //          case (T_void<<4)+T_void              : return NotAConstant;   
102         //          case (T_void<<4)+T_String            : return NotAConstant;   
103         //          case (T_void<<4)+T_Object            : return NotAConstant;   
104         //          case (T_void<<4)+T_double            : return NotAConstant;   
105         //          case (T_void<<4)+T_float             : return NotAConstant;   
106         //          case (T_void<<4)+T_boolean           : return NotAConstant;   
107         //          case (T_void<<4)+T_char              : return NotAConstant;   
108         //          case (T_void<<4)+T_int               : return NotAConstant;   
109         
110         //          case (T_String<<4)+T_undefined   : return NotAConstant;   
111         //          case (T_String<<4)+T_byte            : return NotAConstant;   
112         //          case (T_String<<4)+T_long            : return NotAConstant;   
113         //          case (T_String<<4)+T_short           : return NotAConstant;   
114         //          case (T_String<<4)+T_void            : return NotAConstant;   
115                     case (T_JavaLangString<<4)+T_JavaLangString          : return this;   
116         //          case (T_String<<4)+T_Object          : return NotAConstant;   
117         //          case (T_String<<4)+T_double          : return NotAConstant;   
118         //          case (T_String<<4)+T_float           : return NotAConstant;   
119         //          case (T_String<<4)+T_boolean         : return NotAConstant;   
120         //          case (T_String<<4)+T_char            : return NotAConstant;   
121         //          case (T_String<<4)+T_int             : return NotAConstant;   
122         
123         //          case (T_Object<<4)+T_undefined      : return NotAConstant;   
124         //          case (T_Object<<4)+T_byte                   : return NotAConstant;   
125         //          case (T_Object<<4)+T_long                   : return NotAConstant;   
126         //          case (T_Object<<4)+T_short                  : return NotAConstant;   
127         //          case (T_Object<<4)+T_void                   : return NotAConstant;   
128         //          case (T_Object<<4)+T_String                 : return NotAConstant;   
129         //          case (T_Object<<4)+T_Object                 : return NotAConstant;   
130         //          case (T_Object<<4)+T_double                 : return NotAConstant;   
131         //          case (T_Object<<4)+T_float                  : return NotAConstant;   
132         //          case (T_Object<<4)+T_boolean                : return NotAConstant;   
133         //          case (T_Object<<4)+T_char                   : return NotAConstant;   
134         //          case (T_Object<<4)+T_int                    : return NotAConstant;   
135         
136         //          case (T_double<<4)+T_undefined      : return NotAConstant;   
137                     case (T_double<<4)+T_byte                   : return Constant.fromValue((double)this.byteValue());   
138                     case (T_double<<4)+T_long                   : return Constant.fromValue((double)this.longValue());   
139                     case (T_double<<4)+T_short                  : return Constant.fromValue((double)this.shortValue());   
140         //          case (T_double<<4)+T_void                   : return NotAConstant;   
141         //          case (T_double<<4)+T_String                 : return NotAConstant;   
142         //          case (T_double<<4)+T_Object                 : return NotAConstant;   
143                     case (T_double<<4)+T_double                 : return this;   
144                     case (T_double<<4)+T_float                  : return Constant.fromValue((double)this.floatValue());   
145         //          case (T_double<<4)+T_boolean                : return NotAConstant;   
146                     case (T_double<<4)+T_char                   : return Constant.fromValue((double)this.charValue());   
147                     case (T_double<<4)+T_int                    : return Constant.fromValue((double)this.intValue());  
148         
149         //          case (T_float<<4)+T_undefined        : return NotAConstant;   
150                     case (T_float<<4)+T_byte             : return Constant.fromValue((float)this.byteValue());   
151                     case (T_float<<4)+T_long             : return Constant.fromValue((float)this.longValue());   
152                     case (T_float<<4)+T_short            : return Constant.fromValue((float)this.shortValue());   
153         //          case (T_float<<4)+T_void             : return NotAConstant;   
154         //          case (T_float<<4)+T_String           : return NotAConstant;   
155         //          case (T_float<<4)+T_Object           : return NotAConstant;   
156                     case (T_float<<4)+T_double           : return Constant.fromValue((float)this.doubleValue());   
157                     case (T_float<<4)+T_float            : return this;   
158         //          case (T_float<<4)+T_boolean          : return NotAConstant;   
159                     case (T_float<<4)+T_char             : return Constant.fromValue((float)this.charValue());   
160                     case (T_float<<4)+T_int              : return Constant.fromValue((float)this.intValue());   
161         
162         //          case (T_boolean<<4)+T_undefined              : return NotAConstant;   
163         //          case (T_boolean<<4)+T_byte                           : return NotAConstant;   
164         //          case (T_boolean<<4)+T_long                           : return NotAConstant;   
165         //          case (T_boolean<<4)+T_short                          : return NotAConstant;   
166         //          case (T_boolean<<4)+T_void                           : return NotAConstant;   
167         //          case (T_boolean<<4)+T_String                         : return NotAConstant;   
168         //          case (T_boolean<<4)+T_Object                         : return NotAConstant;   
169         //          case (T_boolean<<4)+T_double                         : return NotAConstant;   
170         //          case (T_boolean<<4)+T_float                          : return NotAConstant;   
171                     case (T_boolean<<4)+T_boolean                        : return this;  
172         //          case (T_boolean<<4)+T_char                           : return NotAConstant;   
173         //          case (T_boolean<<4)+T_int                            : return NotAConstant;   
174                 
175         //          case (T_char<<4)+T_undefined         : return NotAConstant;   
176                     case (T_char<<4)+T_byte              : return Constant.fromValue((char)this.byteValue());  
177                     case (T_char<<4)+T_long              : return Constant.fromValue((char)this.longValue());  
178                     case (T_char<<4)+T_short             : return Constant.fromValue((char)this.shortValue());  
179         //          case (T_char<<4)+T_void              : return NotAConstant;   
180         //          case (T_char<<4)+T_String            : return NotAConstant;   
181         //          case (T_char<<4)+T_Object            : return NotAConstant;   
182                     case (T_char<<4)+T_double            : return Constant.fromValue((char)this.doubleValue());   
183                     case (T_char<<4)+T_float             : return Constant.fromValue((char)this.floatValue());   
184         //          case (T_char<<4)+T_boolean           : return NotAConstant;   
185                     case (T_char<<4)+T_char              : return this;  
186                     case (T_char<<4)+T_int               : return Constant.fromValue((char)this.intValue());  
187                 
188         //          case (T_int<<4)+T_undefined          : return NotAConstant;   
189                     case (T_int<<4)+T_byte               : return Constant.fromValue((int)this.byteValue());  
190                     case (T_int<<4)+T_long               : return Constant.fromValue((int)this.longValue());  
191                     case (T_int<<4)+T_short              : return Constant.fromValue((int)this.shortValue());  
192         //          case (T_int<<4)+T_void               : return NotAConstant;   
193         //          case (T_int<<4)+T_String             : return NotAConstant;   
194         //          case (T_int<<4)+T_Object             : return NotAConstant;   
195                     case (T_int<<4)+T_double             : return Constant.fromValue((int)this.doubleValue());   
196                     case (T_int<<4)+T_float              : return Constant.fromValue((int)this.floatValue());   
197         //          case (T_int<<4)+T_boolean            : return NotAConstant;   
198                     case (T_int<<4)+T_char               : return Constant.fromValue((int)this.charValue());  
199                     case (T_int<<4)+T_int                        : return this;  
200         
201                 }
202         
203                 return NotAConstant;
204         }
205         
206         public char charValue() {
207                 
208                 throw new ShouldNotImplement(Util.bind("constant.cannotCastedInto",typeName(),"char")); //$NON-NLS-1$ //$NON-NLS-2$
209         }
210         
211         public static final Constant computeConstantOperation(Constant cst, int id, int operator) {
212
213                 switch (operator) {
214                         case NOT        :       
215                                                         return Constant.fromValue(!cst.booleanValue());
216                         case PLUS       :
217                                                         return computeConstantOperationPLUS(Zero,T_int,cst,id);
218                         case MINUS      :       //the two special -9223372036854775808L and -2147483648 are inlined at parseTime
219                                                         switch (id){
220                                                                 case T_float  : float f;
221                                                                                                 if ( (f= cst.floatValue()) == 0.0f)
222                                                                                                 { //positive and negative 0....
223                                                                                                         if (Float.floatToIntBits(f) == 0)
224                                                                                                                 return Constant.fromValue(-0.0f);
225                                                                                                         else
226                                                                                                                 return Constant.fromValue(0.0f);}
227                                                                                                 break; //default case
228                                                                 case T_double : double d;
229                                                                                                 if ( (d= cst.doubleValue()) == 0.0d)
230                                                                                                 { //positive and negative 0....
231                                                                                                         if (Double.doubleToLongBits(d) == 0)
232                                                                                                                 return Constant.fromValue(-0.0d);
233                                                                                                         else
234                                                                                                                 return Constant.fromValue(0.0d);}
235                                                                                                 break; //default case
236                                                         }
237                                                         return computeConstantOperationMINUS(Zero,T_int,cst,id);
238                         case TWIDDLE:   
239                                 switch (id){
240                                         case T_char :   return Constant.fromValue(~ cst.charValue());
241                                         case T_byte:    return Constant.fromValue(~ cst.byteValue());
242                                         case T_short:   return Constant.fromValue(~ cst.shortValue());
243                                         case T_int:             return Constant.fromValue(~ cst.intValue());
244                                         case T_long:    return Constant.fromValue(~ cst.longValue());
245                                         default : return NotAConstant;
246                                 } 
247                         default : return NotAConstant;
248                 }
249         } 
250
251         public static final Constant computeConstantOperation(Constant left, int leftId, int operator, Constant right, int rightId) {
252
253                 switch (operator) {
254                         case AND                : return computeConstantOperationAND            (left,leftId,right,rightId);
255                         case AND_AND    : return computeConstantOperationAND_AND        (left,leftId,right,rightId);
256                         case DIVIDE     : return computeConstantOperationDIVIDE         (left,leftId,right,rightId);
257                         case GREATER    : return computeConstantOperationGREATER        (left,leftId,right,rightId);
258                         case GREATER_EQUAL      : return computeConstantOperationGREATER_EQUAL(left,leftId,right,rightId);
259                         case LEFT_SHIFT : return computeConstantOperationLEFT_SHIFT     (left,leftId,right,rightId);
260                         case LESS               : return computeConstantOperationLESS           (left,leftId,right,rightId);
261                         case LESS_EQUAL : return computeConstantOperationLESS_EQUAL     (left,leftId,right,rightId);
262                         case MINUS              : return computeConstantOperationMINUS          (left,leftId,right,rightId);
263                         case MULTIPLY   : return computeConstantOperationMULTIPLY       (left,leftId,right,rightId);
264                         case OR                 : return computeConstantOperationOR                     (left,leftId,right,rightId);
265                         case OR_OR              : return computeConstantOperationOR_OR          (left,leftId,right,rightId);
266                         case PLUS               : return computeConstantOperationPLUS           (left,leftId,right,rightId);
267                         case REMAINDER  : return computeConstantOperationREMAINDER      (left,leftId,right,rightId);
268                         case RIGHT_SHIFT: return computeConstantOperationRIGHT_SHIFT(left,leftId,right,rightId);
269                         case UNSIGNED_RIGHT_SHIFT: return computeConstantOperationUNSIGNED_RIGHT_SHIFT(left,leftId,right,rightId);
270                         case XOR                : return computeConstantOperationXOR            (left,leftId,right,rightId);
271         
272                         default : return NotAConstant;
273                 }
274         }
275         
276         public static final Constant computeConstantOperationAND(Constant left, int leftId, Constant right, int rightId) {
277                 
278                 switch (leftId){
279                         case T_boolean :                return Constant.fromValue(left.booleanValue() & right.booleanValue());
280                         case T_char :
281                                 switch (rightId){
282                                         case T_char :   return Constant.fromValue(left.charValue() & right.charValue());
283                                         case T_byte:    return Constant.fromValue(left.charValue() & right.byteValue());
284                                         case T_short:   return Constant.fromValue(left.charValue() & right.shortValue());
285                                         case T_int:             return Constant.fromValue(left.charValue() & right.intValue());
286                                         case T_long:    return Constant.fromValue(left.charValue() & right.longValue());
287                                 }
288                         break;
289                         case T_byte :
290                                 switch (rightId){
291                                         case T_char :   return Constant.fromValue(left.byteValue() & right.charValue());
292                                         case T_byte:    return Constant.fromValue(left.byteValue() & right.byteValue());
293                                         case T_short:   return Constant.fromValue(left.byteValue() & right.shortValue());
294                                         case T_int:             return Constant.fromValue(left.byteValue() & right.intValue());
295                                         case T_long:    return Constant.fromValue(left.byteValue() & right.longValue());
296                                 }
297                         break;
298                         case T_short :
299                                 switch (rightId){
300                                         case T_char :   return Constant.fromValue(left.shortValue() & right.charValue());
301                                         case T_byte:    return Constant.fromValue(left.shortValue() & right.byteValue());
302                                         case T_short:   return Constant.fromValue(left.shortValue() & right.shortValue());
303                                         case T_int:             return Constant.fromValue(left.shortValue() & right.intValue());
304                                         case T_long:    return Constant.fromValue(left.shortValue() & right.longValue());
305                                 }
306                         break;
307                         case T_int :
308                                 switch (rightId){
309                                         case T_char :   return Constant.fromValue(left.intValue() & right.charValue());
310                                         case T_byte:    return Constant.fromValue(left.intValue() & right.byteValue());
311                                         case T_short:   return Constant.fromValue(left.intValue() & right.shortValue());
312                                         case T_int:             return Constant.fromValue(left.intValue() & right.intValue());
313                                         case T_long:    return Constant.fromValue(left.intValue() & right.longValue());
314                                 }
315                         break;
316                         case T_long :
317                                 switch (rightId){
318                                         case T_char :   return Constant.fromValue(left.longValue() & right.charValue());
319                                         case T_byte:    return Constant.fromValue(left.longValue() & right.byteValue());
320                                         case T_short:   return Constant.fromValue(left.longValue() & right.shortValue());
321                                         case T_int:             return Constant.fromValue(left.longValue() & right.intValue());
322                                         case T_long:    return Constant.fromValue(left.longValue() & right.longValue());
323                                 }
324                         }
325                 
326                 return NotAConstant;
327         } 
328                 
329         public static final Constant computeConstantOperationAND_AND(Constant left, int leftId, Constant right, int rightId) {
330         
331                 return Constant.fromValue(left.booleanValue() && right.booleanValue());
332         }
333                 
334         public static final Constant computeConstantOperationDIVIDE(Constant left, int leftId, Constant right, int rightId) {
335                 // division by zero must be handled outside this method (error reporting)
336         
337                 switch (leftId){
338                         case T_char :
339                                 switch (rightId){
340                                         case T_char :   return Constant.fromValue(left.charValue() / right.charValue());
341                                         case T_float:   return Constant.fromValue(left.charValue() / right.floatValue());
342                                         case T_double:  return Constant.fromValue(left.charValue() / right.doubleValue());
343                                         case T_byte:    return Constant.fromValue(left.charValue() / right.byteValue());
344                                         case T_short:   return Constant.fromValue(left.charValue() / right.shortValue());
345                                         case T_int:             return Constant.fromValue(left.charValue() / right.intValue());
346                                         case T_long:    return Constant.fromValue(left.charValue() / right.longValue());
347                                 }
348                         break;
349                         case T_float :
350                                 switch (rightId){
351                                         case T_char :   return Constant.fromValue(left.floatValue() / right.charValue());
352                                         case T_float:   return Constant.fromValue(left.floatValue() / right.floatValue());
353                                         case T_double:  return Constant.fromValue(left.floatValue() / right.doubleValue());
354                                         case T_byte:    return Constant.fromValue(left.floatValue() / right.byteValue());
355                                         case T_short:   return Constant.fromValue(left.floatValue() / right.shortValue());
356                                         case T_int:             return Constant.fromValue(left.floatValue() / right.intValue());
357                                         case T_long:    return Constant.fromValue(left.floatValue() / right.longValue());
358                                 }
359                         break;
360                         case T_double :
361                                 switch (rightId){
362                                         case T_char :   return Constant.fromValue(left.doubleValue() / right.charValue());
363                                         case T_float:   return Constant.fromValue(left.doubleValue() / right.floatValue());
364                                         case T_double:  return Constant.fromValue(left.doubleValue() / right.doubleValue());
365                                         case T_byte:    return Constant.fromValue(left.doubleValue() / right.byteValue());
366                                         case T_short:   return Constant.fromValue(left.doubleValue() / right.shortValue());
367                                         case T_int:             return Constant.fromValue(left.doubleValue() / right.intValue());
368                                         case T_long:    return Constant.fromValue(left.doubleValue() / right.longValue());
369                                 }
370                         break;
371                         case T_byte :
372                                 switch (rightId){
373                                         case T_char :   return Constant.fromValue(left.byteValue() / right.charValue());
374                                         case T_float:   return Constant.fromValue(left.byteValue() / right.floatValue());
375                                         case T_double:  return Constant.fromValue(left.byteValue() / right.doubleValue());
376                                         case T_byte:    return Constant.fromValue(left.byteValue() / right.byteValue());
377                                         case T_short:   return Constant.fromValue(left.byteValue() / right.shortValue());
378                                         case T_int:             return Constant.fromValue(left.byteValue() / right.intValue());
379                                         case T_long:    return Constant.fromValue(left.byteValue() / right.longValue());
380                                 }
381                         break;
382                         case T_short :
383                                 switch (rightId){
384                                         case T_char :   return Constant.fromValue(left.shortValue() / right.charValue());
385                                         case T_float:   return Constant.fromValue(left.shortValue() / right.floatValue());
386                                         case T_double:  return Constant.fromValue(left.shortValue() / right.doubleValue());
387                                         case T_byte:    return Constant.fromValue(left.shortValue() / right.byteValue());
388                                         case T_short:   return Constant.fromValue(left.shortValue() / right.shortValue());
389                                         case T_int:             return Constant.fromValue(left.shortValue() / right.intValue());
390                                         case T_long:    return Constant.fromValue(left.shortValue() / right.longValue());
391                                 }
392                         break;
393                         case T_int :
394                                 switch (rightId){
395                                         case T_char :   return Constant.fromValue(left.intValue() / right.charValue());
396                                         case T_float:   return Constant.fromValue(left.intValue() / right.floatValue());
397                                         case T_double:  return Constant.fromValue(left.intValue() / right.doubleValue());
398                                         case T_byte:    return Constant.fromValue(left.intValue() / right.byteValue());
399                                         case T_short:   return Constant.fromValue(left.intValue() / right.shortValue());
400                                         case T_int:             return Constant.fromValue(left.intValue() / right.intValue());
401                                         case T_long:    return Constant.fromValue(left.intValue() / right.longValue());
402                                 }
403                         break;
404                         case T_long :
405                                 switch (rightId){
406                                         case T_char :   return Constant.fromValue(left.longValue() / right.charValue());
407                                         case T_float:   return Constant.fromValue(left.longValue() / right.floatValue());
408                                         case T_double:  return Constant.fromValue(left.longValue() / right.doubleValue());
409                                         case T_byte:    return Constant.fromValue(left.longValue() / right.byteValue());
410                                         case T_short:   return Constant.fromValue(left.longValue() / right.shortValue());
411                                         case T_int:             return Constant.fromValue(left.longValue() / right.intValue());
412                                         case T_long:    return Constant.fromValue(left.longValue() / right.longValue());
413                                 }
414         
415                         }
416                 
417                 return NotAConstant;
418         } 
419                 
420         public static final Constant computeConstantOperationEQUAL_EQUAL(Constant left, int leftId, Constant right, int rightId) {
421                 
422                 switch (leftId){
423                         case T_boolean :
424                                 if (rightId == T_boolean) {
425                                         return Constant.fromValue(left.booleanValue() == right.booleanValue());
426                                 }
427                         break;
428                         case T_char :
429                                 switch (rightId){
430                                         case T_char :   return Constant.fromValue(left.charValue() == right.charValue());
431                                         case T_float:   return Constant.fromValue(left.charValue() == right.floatValue());
432                                         case T_double:  return Constant.fromValue(left.charValue() == right.doubleValue());
433                                         case T_byte:    return Constant.fromValue(left.charValue() == right.byteValue());
434                                         case T_short:   return Constant.fromValue(left.charValue() == right.shortValue());
435                                         case T_int:             return Constant.fromValue(left.charValue() == right.intValue());
436                                         case T_long:    return Constant.fromValue(left.charValue() == right.longValue());}
437                         break;
438                         case T_float :
439                                 switch (rightId){
440                                         case T_char :   return Constant.fromValue(left.floatValue() == right.charValue());
441                                         case T_float:   return Constant.fromValue(left.floatValue() == right.floatValue());
442                                         case T_double:  return Constant.fromValue(left.floatValue() == right.doubleValue());
443                                         case T_byte:    return Constant.fromValue(left.floatValue() == right.byteValue());
444                                         case T_short:   return Constant.fromValue(left.floatValue() == right.shortValue());
445                                         case T_int:             return Constant.fromValue(left.floatValue() == right.intValue());
446                                         case T_long:    return Constant.fromValue(left.floatValue() == right.longValue());
447                                 }
448                         break;
449                         case T_double :
450                                 switch (rightId){
451                                         case T_char :   return Constant.fromValue(left.doubleValue() == right.charValue());
452                                         case T_float:   return Constant.fromValue(left.doubleValue() == right.floatValue());
453                                         case T_double:  return Constant.fromValue(left.doubleValue() == right.doubleValue());
454                                         case T_byte:    return Constant.fromValue(left.doubleValue() == right.byteValue());
455                                         case T_short:   return Constant.fromValue(left.doubleValue() == right.shortValue());
456                                         case T_int:             return Constant.fromValue(left.doubleValue() == right.intValue());
457                                         case T_long:    return Constant.fromValue(left.doubleValue() == right.longValue());
458                                 }
459                         break;
460                         case T_byte :
461                                 switch (rightId){
462                                         case T_char :   return Constant.fromValue(left.byteValue() == right.charValue());
463                                         case T_float:   return Constant.fromValue(left.byteValue() == right.floatValue());
464                                         case T_double:  return Constant.fromValue(left.byteValue() == right.doubleValue());
465                                         case T_byte:    return Constant.fromValue(left.byteValue() == right.byteValue());
466                                         case T_short:   return Constant.fromValue(left.byteValue() == right.shortValue());
467                                         case T_int:             return Constant.fromValue(left.byteValue() == right.intValue());
468                                         case T_long:    return Constant.fromValue(left.byteValue() == right.longValue());
469                                 }
470                         break;                  
471                         case T_short :
472                                 switch (rightId){
473                                         case T_char :   return Constant.fromValue(left.shortValue() == right.charValue());
474                                         case T_float:   return Constant.fromValue(left.shortValue() == right.floatValue());
475                                         case T_double:  return Constant.fromValue(left.shortValue() == right.doubleValue());
476                                         case T_byte:    return Constant.fromValue(left.shortValue() == right.byteValue());
477                                         case T_short:   return Constant.fromValue(left.shortValue() == right.shortValue());
478                                         case T_int:             return Constant.fromValue(left.shortValue() == right.intValue());
479                                         case T_long:    return Constant.fromValue(left.shortValue() == right.longValue());
480                                 }
481                         break;
482                         case T_int :
483                                 switch (rightId){
484                                         case T_char :   return Constant.fromValue(left.intValue() == right.charValue());
485                                         case T_float:   return Constant.fromValue(left.intValue() == right.floatValue());
486                                         case T_double:  return Constant.fromValue(left.intValue() == right.doubleValue());
487                                         case T_byte:    return Constant.fromValue(left.intValue() == right.byteValue());
488                                         case T_short:   return Constant.fromValue(left.intValue() == right.shortValue());
489                                         case T_int:             return Constant.fromValue(left.intValue() == right.intValue());
490                                         case T_long:    return Constant.fromValue(left.intValue() == right.longValue());
491                                 }
492                         break;          
493                         case T_long :
494                                 switch (rightId){
495                                         case T_char :   return Constant.fromValue(left.longValue() == right.charValue());
496                                         case T_float:   return Constant.fromValue(left.longValue() == right.floatValue());
497                                         case T_double:  return Constant.fromValue(left.longValue() == right.doubleValue());
498                                         case T_byte:    return Constant.fromValue(left.longValue() == right.byteValue());
499                                         case T_short:   return Constant.fromValue(left.longValue() == right.shortValue());
500                                         case T_int:             return Constant.fromValue(left.longValue() == right.intValue());
501                                         case T_long:    return Constant.fromValue(left.longValue() == right.longValue());
502                                 }
503                         break;
504                         case T_JavaLangString :
505                                 if (rightId == T_JavaLangString) {
506                                         //String are interned in th compiler==>thus if two string constant
507                                         //get to be compared, it is an equal on the vale which is done
508                                         return Constant.fromValue(((StringConstant)left).compileTimeEqual((StringConstant)right));
509                                 }
510                         break;  
511                         case T_null :
512                                 if (rightId == T_JavaLangString) { 
513                                         return Constant.fromValue(false);
514                                 } else {
515                                         if (rightId == T_null) { 
516                                                 return Constant.fromValue(true);
517                                         }
518                                 }
519                         }
520                 
521                 return Constant.fromValue(false);
522         }
523                 
524         public static final Constant computeConstantOperationGREATER(Constant left, int leftId, Constant right, int rightId) {
525                 
526                 switch (leftId){
527                         case T_char : 
528                                 switch (rightId){
529                                         case T_char :   return Constant.fromValue(left.charValue() > right.charValue());
530                                         case T_float:   return Constant.fromValue(left.charValue() > right.floatValue());
531                                         case T_double:  return Constant.fromValue(left.charValue() > right.doubleValue());
532                                         case T_byte:    return Constant.fromValue(left.charValue() > right.byteValue());
533                                         case T_short:   return Constant.fromValue(left.charValue() > right.shortValue());
534                                         case T_int:             return Constant.fromValue(left.charValue() > right.intValue());
535                                         case T_long:    return Constant.fromValue(left.charValue() > right.longValue());
536                                 }
537                         break;
538                         case T_float :
539                                 switch (rightId){
540                                         case T_char :   return Constant.fromValue(left.floatValue() > right.charValue());
541                                         case T_float:   return Constant.fromValue(left.floatValue() > right.floatValue());
542                                         case T_double:  return Constant.fromValue(left.floatValue() > right.doubleValue());
543                                         case T_byte:    return Constant.fromValue(left.floatValue() > right.byteValue());
544                                         case T_short:   return Constant.fromValue(left.floatValue() > right.shortValue());
545                                         case T_int:             return Constant.fromValue(left.floatValue() > right.intValue());
546                                         case T_long:    return Constant.fromValue(left.floatValue() > right.longValue());
547                                 }
548                         break;
549                         case T_double :
550                                 switch (rightId){
551                                         case T_char :   return Constant.fromValue(left.doubleValue() > right.charValue());
552                                         case T_float:   return Constant.fromValue(left.doubleValue() > right.floatValue());
553                                         case T_double:  return Constant.fromValue(left.doubleValue() > right.doubleValue());
554                                         case T_byte:    return Constant.fromValue(left.doubleValue() > right.byteValue());
555                                         case T_short:   return Constant.fromValue(left.doubleValue() > right.shortValue());
556                                         case T_int:             return Constant.fromValue(left.doubleValue() > right.intValue());
557                                         case T_long:    return Constant.fromValue(left.doubleValue() > right.longValue());
558                                 }
559                         break;
560                         case T_byte :
561                                 switch (rightId){
562                                         case T_char :   return Constant.fromValue(left.byteValue() > right.charValue());
563                                         case T_float:   return Constant.fromValue(left.byteValue() > right.floatValue());
564                                         case T_double:  return Constant.fromValue(left.byteValue() > right.doubleValue());
565                                         case T_byte:    return Constant.fromValue(left.byteValue() > right.byteValue());
566                                         case T_short:   return Constant.fromValue(left.byteValue() > right.shortValue());
567                                         case T_int:             return Constant.fromValue(left.byteValue() > right.intValue());
568                                         case T_long:    return Constant.fromValue(left.byteValue() > right.longValue());
569                                 }
570                         break;                  
571                         case T_short :
572                                 switch (rightId){
573                                         case T_char :   return Constant.fromValue(left.shortValue() > right.charValue());
574                                         case T_float:   return Constant.fromValue(left.shortValue() > right.floatValue());
575                                         case T_double:  return Constant.fromValue(left.shortValue() > right.doubleValue());
576                                         case T_byte:    return Constant.fromValue(left.shortValue() > right.byteValue());
577                                         case T_short:   return Constant.fromValue(left.shortValue() > right.shortValue());
578                                         case T_int:             return Constant.fromValue(left.shortValue() > right.intValue());
579                                         case T_long:    return Constant.fromValue(left.shortValue() > right.longValue());
580                                 }
581                         break;
582                         case T_int :
583                                 switch (rightId){
584                                         case T_char :   return Constant.fromValue(left.intValue() > right.charValue());
585                                         case T_float:   return Constant.fromValue(left.intValue() > right.floatValue());
586                                         case T_double:  return Constant.fromValue(left.intValue() > right.doubleValue());
587                                         case T_byte:    return Constant.fromValue(left.intValue() > right.byteValue());
588                                         case T_short:   return Constant.fromValue(left.intValue() > right.shortValue());
589                                         case T_int:             return Constant.fromValue(left.intValue() > right.intValue());
590                                         case T_long:    return Constant.fromValue(left.intValue() > right.longValue());
591                                 }
592                         break;          
593                         case T_long :
594                                 switch (rightId){
595                                         case T_char :   return Constant.fromValue(left.longValue() > right.charValue());
596                                         case T_float:   return Constant.fromValue(left.longValue() > right.floatValue());
597                                         case T_double:  return Constant.fromValue(left.longValue() > right.doubleValue());
598                                         case T_byte:    return Constant.fromValue(left.longValue() > right.byteValue());
599                                         case T_short:   return Constant.fromValue(left.longValue() > right.shortValue());
600                                         case T_int:             return Constant.fromValue(left.longValue() > right.intValue());
601                                         case T_long:    return Constant.fromValue(left.longValue() > right.longValue());
602                                 }
603                                 
604                         }
605                 
606                 return NotAConstant;
607         }
608
609         public static final Constant computeConstantOperationGREATER_EQUAL(Constant left, int leftId, Constant right, int rightId) {
610                 
611                 switch (leftId){
612                         case T_char : 
613                                 switch (rightId){
614                                         case T_char :   return Constant.fromValue(left.charValue() >= right.charValue());
615                                         case T_float:   return Constant.fromValue(left.charValue() >= right.floatValue());
616                                         case T_double:  return Constant.fromValue(left.charValue() >= right.doubleValue());
617                                         case T_byte:    return Constant.fromValue(left.charValue() >= right.byteValue());
618                                         case T_short:   return Constant.fromValue(left.charValue() >= right.shortValue());
619                                         case T_int:             return Constant.fromValue(left.charValue() >= right.intValue());
620                                         case T_long:    return Constant.fromValue(left.charValue() >= right.longValue());
621                                 }
622                         break;
623                         case T_float :
624                                 switch (rightId){
625                                         case T_char :   return Constant.fromValue(left.floatValue() >= right.charValue());
626                                         case T_float:   return Constant.fromValue(left.floatValue() >= right.floatValue());
627                                         case T_double:  return Constant.fromValue(left.floatValue() >= right.doubleValue());
628                                         case T_byte:    return Constant.fromValue(left.floatValue() >= right.byteValue());
629                                         case T_short:   return Constant.fromValue(left.floatValue() >= right.shortValue());
630                                         case T_int:             return Constant.fromValue(left.floatValue() >= right.intValue());
631                                         case T_long:    return Constant.fromValue(left.floatValue() >= right.longValue());
632                                 }
633                         break;
634                         case T_double :
635                                 switch (rightId){
636                                         case T_char :   return Constant.fromValue(left.doubleValue() >= right.charValue());
637                                         case T_float:   return Constant.fromValue(left.doubleValue() >= right.floatValue());
638                                         case T_double:  return Constant.fromValue(left.doubleValue() >= right.doubleValue());
639                                         case T_byte:    return Constant.fromValue(left.doubleValue() >= right.byteValue());
640                                         case T_short:   return Constant.fromValue(left.doubleValue() >= right.shortValue());
641                                         case T_int:             return Constant.fromValue(left.doubleValue() >= right.intValue());
642                                         case T_long:    return Constant.fromValue(left.doubleValue() >= right.longValue());
643                                 }
644                         break;
645                         case T_byte :
646                                 switch (rightId){
647                                         case T_char :   return Constant.fromValue(left.byteValue() >= right.charValue());
648                                         case T_float:   return Constant.fromValue(left.byteValue() >= right.floatValue());
649                                         case T_double:  return Constant.fromValue(left.byteValue() >= right.doubleValue());
650                                         case T_byte:    return Constant.fromValue(left.byteValue() >= right.byteValue());
651                                         case T_short:   return Constant.fromValue(left.byteValue() >= right.shortValue());
652                                         case T_int:             return Constant.fromValue(left.byteValue() >= right.intValue());
653                                         case T_long:    return Constant.fromValue(left.byteValue() >= right.longValue());
654                                 }
655                         break;                  
656                         case T_short :
657                                 switch (rightId){
658                                         case T_char :   return Constant.fromValue(left.shortValue() >= right.charValue());
659                                         case T_float:   return Constant.fromValue(left.shortValue() >= right.floatValue());
660                                         case T_double:  return Constant.fromValue(left.shortValue() >= right.doubleValue());
661                                         case T_byte:    return Constant.fromValue(left.shortValue() >= right.byteValue());
662                                         case T_short:   return Constant.fromValue(left.shortValue() >= right.shortValue());
663                                         case T_int:             return Constant.fromValue(left.shortValue() >= right.intValue());
664                                         case T_long:    return Constant.fromValue(left.shortValue() >= right.longValue());
665                                 }
666                         break;
667                         case T_int :
668                                 switch (rightId){
669                                         case T_char :   return Constant.fromValue(left.intValue() >= right.charValue());
670                                         case T_float:   return Constant.fromValue(left.intValue() >= right.floatValue());
671                                         case T_double:  return Constant.fromValue(left.intValue() >= right.doubleValue());
672                                         case T_byte:    return Constant.fromValue(left.intValue() >= right.byteValue());
673                                         case T_short:   return Constant.fromValue(left.intValue() >= right.shortValue());
674                                         case T_int:             return Constant.fromValue(left.intValue() >= right.intValue());
675                                         case T_long:    return Constant.fromValue(left.intValue() >= right.longValue());
676                                 }
677                         break;          
678                         case T_long :
679                                 switch (rightId){
680                                         case T_char :   return Constant.fromValue(left.longValue() >= right.charValue());
681                                         case T_float:   return Constant.fromValue(left.longValue() >= right.floatValue());
682                                         case T_double:  return Constant.fromValue(left.longValue() >= right.doubleValue());
683                                         case T_byte:    return Constant.fromValue(left.longValue() >= right.byteValue());
684                                         case T_short:   return Constant.fromValue(left.longValue() >= right.shortValue());
685                                         case T_int:             return Constant.fromValue(left.longValue() >= right.intValue());
686                                         case T_long:    return Constant.fromValue(left.longValue() >= right.longValue());
687                                 }
688                                 
689                         }
690                 
691                 return NotAConstant;
692         }  
693                 
694         public static final Constant computeConstantOperationLEFT_SHIFT(Constant left, int leftId, Constant right, int rightId) {
695                 
696                 switch (leftId){
697                         case T_char :
698                                 switch (rightId){
699                                         case T_char :   return Constant.fromValue(left.charValue() << right.charValue());
700                                         case T_byte:    return Constant.fromValue(left.charValue() << right.byteValue());
701                                         case T_short:   return Constant.fromValue(left.charValue() << right.shortValue());
702                                         case T_int:             return Constant.fromValue(left.charValue() << right.intValue());
703                                         case T_long:    return Constant.fromValue(left.charValue() << right.longValue());
704                                 }
705                         break;
706                         case T_byte :
707                                 switch (rightId){
708                                         case T_char :   return Constant.fromValue(left.byteValue() << right.charValue());
709                                         case T_byte:    return Constant.fromValue(left.byteValue() << right.byteValue());
710                                         case T_short:   return Constant.fromValue(left.byteValue() << right.shortValue());
711                                         case T_int:             return Constant.fromValue(left.byteValue() << right.intValue());
712                                         case T_long:    return Constant.fromValue(left.byteValue() << right.longValue());
713                                 }
714                         break;
715                         case T_short :
716                                 switch (rightId){
717                                         case T_char :   return Constant.fromValue(left.shortValue() << right.charValue());
718                                         case T_byte:    return Constant.fromValue(left.shortValue() << right.byteValue());
719                                         case T_short:   return Constant.fromValue(left.shortValue() << right.shortValue());
720                                         case T_int:             return Constant.fromValue(left.shortValue() << right.intValue());
721                                         case T_long:    return Constant.fromValue(left.shortValue() << right.longValue());
722                                 }
723                         break;
724                         case T_int :
725                                 switch (rightId){
726                                         case T_char :   return Constant.fromValue(left.intValue() << right.charValue());
727                                         case T_byte:    return Constant.fromValue(left.intValue() << right.byteValue());
728                                         case T_short:   return Constant.fromValue(left.intValue() << right.shortValue());
729                                         case T_int:             return Constant.fromValue(left.intValue() << right.intValue());
730                                         case T_long:    return Constant.fromValue(left.intValue() << right.longValue());
731                                 }
732                         break;
733                         case T_long :
734                                 switch (rightId){
735                                         case T_char :   return Constant.fromValue(left.longValue() << right.charValue());
736                                         case T_byte:    return Constant.fromValue(left.longValue() << right.byteValue());
737                                         case T_short:   return Constant.fromValue(left.longValue() << right.shortValue());
738                                         case T_int:             return Constant.fromValue(left.longValue() << right.intValue());
739                                         case T_long:    return Constant.fromValue(left.longValue() << right.longValue());
740                                 }
741         
742                         }
743         
744                 return NotAConstant;
745         } 
746                 
747         public static final Constant computeConstantOperationLESS(Constant left, int leftId, Constant right, int rightId) { 
748                 
749                 switch (leftId){
750                         case T_char : 
751                                 switch (rightId){
752                                         case T_char :   return Constant.fromValue(left.charValue() < right.charValue());
753                                         case T_float:   return Constant.fromValue(left.charValue() < right.floatValue());
754                                         case T_double:  return Constant.fromValue(left.charValue() < right.doubleValue());
755                                         case T_byte:    return Constant.fromValue(left.charValue() < right.byteValue());
756                                         case T_short:   return Constant.fromValue(left.charValue() < right.shortValue());
757                                         case T_int:             return Constant.fromValue(left.charValue() < right.intValue());
758                                         case T_long:    return Constant.fromValue(left.charValue() < right.longValue());
759                                 }
760                         break;
761                         case T_float :
762                                 switch (rightId){
763                                         case T_char :   return Constant.fromValue(left.floatValue() < right.charValue());
764                                         case T_float:   return Constant.fromValue(left.floatValue() < right.floatValue());
765                                         case T_double:  return Constant.fromValue(left.floatValue() < right.doubleValue());
766                                         case T_byte:    return Constant.fromValue(left.floatValue() < right.byteValue());
767                                         case T_short:   return Constant.fromValue(left.floatValue() < right.shortValue());
768                                         case T_int:             return Constant.fromValue(left.floatValue() < right.intValue());
769                                         case T_long:    return Constant.fromValue(left.floatValue() < right.longValue());
770                                 }
771                         break;
772                         case T_double :
773                                 switch (rightId){
774                                         case T_char :   return Constant.fromValue(left.doubleValue() < right.charValue());
775                                         case T_float:   return Constant.fromValue(left.doubleValue() < right.floatValue());
776                                         case T_double:  return Constant.fromValue(left.doubleValue() < right.doubleValue());
777                                         case T_byte:    return Constant.fromValue(left.doubleValue() < right.byteValue());
778                                         case T_short:   return Constant.fromValue(left.doubleValue() < right.shortValue());
779                                         case T_int:             return Constant.fromValue(left.doubleValue() < right.intValue());
780                                         case T_long:    return Constant.fromValue(left.doubleValue() < right.longValue());
781                                 }
782                         break;
783                         case T_byte :
784                                 switch (rightId){
785                                         case T_char :   return Constant.fromValue(left.byteValue() < right.charValue());
786                                         case T_float:   return Constant.fromValue(left.byteValue() < right.floatValue());
787                                         case T_double:  return Constant.fromValue(left.byteValue() < right.doubleValue());
788                                         case T_byte:    return Constant.fromValue(left.byteValue() < right.byteValue());
789                                         case T_short:   return Constant.fromValue(left.byteValue() < right.shortValue());
790                                         case T_int:             return Constant.fromValue(left.byteValue() < right.intValue());
791                                         case T_long:    return Constant.fromValue(left.byteValue() < right.longValue());
792                                 }
793                         break;                  
794                         case T_short :
795                                 switch (rightId){
796                                         case T_char :   return Constant.fromValue(left.shortValue() < right.charValue());
797                                         case T_float:   return Constant.fromValue(left.shortValue() < right.floatValue());
798                                         case T_double:  return Constant.fromValue(left.shortValue() < right.doubleValue());
799                                         case T_byte:    return Constant.fromValue(left.shortValue() < right.byteValue());
800                                         case T_short:   return Constant.fromValue(left.shortValue() < right.shortValue());
801                                         case T_int:             return Constant.fromValue(left.shortValue() < right.intValue());
802                                         case T_long:    return Constant.fromValue(left.shortValue() < right.longValue());
803                                 }
804                         break;
805                         case T_int :
806                                 switch (rightId){
807                                         case T_char :   return Constant.fromValue(left.intValue() < right.charValue());
808                                         case T_float:   return Constant.fromValue(left.intValue() < right.floatValue());
809                                         case T_double:  return Constant.fromValue(left.intValue() < right.doubleValue());
810                                         case T_byte:    return Constant.fromValue(left.intValue() < right.byteValue());
811                                         case T_short:   return Constant.fromValue(left.intValue() < right.shortValue());
812                                         case T_int:             return Constant.fromValue(left.intValue() < right.intValue());
813                                         case T_long:    return Constant.fromValue(left.intValue() < right.longValue());
814                                 }
815                         break;          
816                         case T_long :
817                                 switch (rightId){
818                                         case T_char :   return Constant.fromValue(left.longValue() < right.charValue());
819                                         case T_float:   return Constant.fromValue(left.longValue() < right.floatValue());
820                                         case T_double:  return Constant.fromValue(left.longValue() < right.doubleValue());
821                                         case T_byte:    return Constant.fromValue(left.longValue() < right.byteValue());
822                                         case T_short:   return Constant.fromValue(left.longValue() < right.shortValue());
823                                         case T_int:             return Constant.fromValue(left.longValue() < right.intValue());
824                                         case T_long:    return Constant.fromValue(left.longValue() < right.longValue());
825                                 }
826                                 
827                         }
828                 
829                 return NotAConstant;
830         }
831                 
832         public static final Constant computeConstantOperationLESS_EQUAL(Constant left, int leftId, Constant right, int rightId) {
833                 
834                 switch (leftId){
835                         case T_char : 
836                                 switch (rightId){
837                                         case T_char :   return Constant.fromValue(left.charValue() <= right.charValue());
838                                         case T_float:   return Constant.fromValue(left.charValue() <= right.floatValue());
839                                         case T_double:  return Constant.fromValue(left.charValue() <= right.doubleValue());
840                                         case T_byte:    return Constant.fromValue(left.charValue() <= right.byteValue());
841                                         case T_short:   return Constant.fromValue(left.charValue() <= right.shortValue());
842                                         case T_int:             return Constant.fromValue(left.charValue() <= right.intValue());
843                                         case T_long:    return Constant.fromValue(left.charValue() <= right.longValue());
844                                 }
845                         break;
846                         case T_float :
847                                 switch (rightId){
848                                         case T_char :   return Constant.fromValue(left.floatValue() <= right.charValue());
849                                         case T_float:   return Constant.fromValue(left.floatValue() <= right.floatValue());
850                                         case T_double:  return Constant.fromValue(left.floatValue() <= right.doubleValue());
851                                         case T_byte:    return Constant.fromValue(left.floatValue() <= right.byteValue());
852                                         case T_short:   return Constant.fromValue(left.floatValue() <= right.shortValue());
853                                         case T_int:             return Constant.fromValue(left.floatValue() <= right.intValue());
854                                         case T_long:    return Constant.fromValue(left.floatValue() <= right.longValue());
855                                 }
856                         break;
857                         case T_double :
858                                 switch (rightId){
859                                         case T_char :   return Constant.fromValue(left.doubleValue() <= right.charValue());
860                                         case T_float:   return Constant.fromValue(left.doubleValue() <= right.floatValue());
861                                         case T_double:  return Constant.fromValue(left.doubleValue() <= right.doubleValue());
862                                         case T_byte:    return Constant.fromValue(left.doubleValue() <= right.byteValue());
863                                         case T_short:   return Constant.fromValue(left.doubleValue() <= right.shortValue());
864                                         case T_int:             return Constant.fromValue(left.doubleValue() <= right.intValue());
865                                         case T_long:    return Constant.fromValue(left.doubleValue() <= right.longValue());
866                                 }
867                         break;
868                         case T_byte :
869                                 switch (rightId){
870                                         case T_char :   return Constant.fromValue(left.byteValue() <= right.charValue());
871                                         case T_float:   return Constant.fromValue(left.byteValue() <= right.floatValue());
872                                         case T_double:  return Constant.fromValue(left.byteValue() <= right.doubleValue());
873                                         case T_byte:    return Constant.fromValue(left.byteValue() <= right.byteValue());
874                                         case T_short:   return Constant.fromValue(left.byteValue() <= right.shortValue());
875                                         case T_int:             return Constant.fromValue(left.byteValue() <= right.intValue());
876                                         case T_long:    return Constant.fromValue(left.byteValue() <= right.longValue());
877                                 }
878                         break;                  
879                         case T_short :
880                                 switch (rightId){
881                                         case T_char :   return Constant.fromValue(left.shortValue() <= right.charValue());
882                                         case T_float:   return Constant.fromValue(left.shortValue() <= right.floatValue());
883                                         case T_double:  return Constant.fromValue(left.shortValue() <= right.doubleValue());
884                                         case T_byte:    return Constant.fromValue(left.shortValue() <= right.byteValue());
885                                         case T_short:   return Constant.fromValue(left.shortValue() <= right.shortValue());
886                                         case T_int:             return Constant.fromValue(left.shortValue() <= right.intValue());
887                                         case T_long:    return Constant.fromValue(left.shortValue() <= right.longValue());
888                                 }
889                         break;
890                         case T_int :
891                                 switch (rightId){
892                                         case T_char :   return Constant.fromValue(left.intValue() <= right.charValue());
893                                         case T_float:   return Constant.fromValue(left.intValue() <= right.floatValue());
894                                         case T_double:  return Constant.fromValue(left.intValue() <= right.doubleValue());
895                                         case T_byte:    return Constant.fromValue(left.intValue() <= right.byteValue());
896                                         case T_short:   return Constant.fromValue(left.intValue() <= right.shortValue());
897                                         case T_int:             return Constant.fromValue(left.intValue() <= right.intValue());
898                                         case T_long:    return Constant.fromValue(left.intValue() <= right.longValue());
899                                 }
900                         break;          
901                         case T_long :
902                                 switch (rightId){
903                                         case T_char :   return Constant.fromValue(left.longValue() <= right.charValue());
904                                         case T_float:   return Constant.fromValue(left.longValue() <= right.floatValue());
905                                         case T_double:  return Constant.fromValue(left.longValue() <= right.doubleValue());
906                                         case T_byte:    return Constant.fromValue(left.longValue() <= right.byteValue());
907                                         case T_short:   return Constant.fromValue(left.longValue() <= right.shortValue());
908                                         case T_int:             return Constant.fromValue(left.longValue() <= right.intValue());
909                                         case T_long:    return Constant.fromValue(left.longValue() <= right.longValue());
910                                 }
911                         }
912                 
913                 return NotAConstant;
914         }  
915         
916         public static final Constant computeConstantOperationMINUS(Constant left, int leftId, Constant right, int rightId) {
917                 
918                 switch (leftId){
919                         case T_char : 
920                                 switch (rightId){
921                                         case T_char :   return Constant.fromValue(left.charValue() - right.charValue());
922                                         case T_float:   return Constant.fromValue(left.charValue() - right.floatValue());
923                                         case T_double:  return Constant.fromValue(left.charValue() - right.doubleValue());
924                                         case T_byte:    return Constant.fromValue(left.charValue() - right.byteValue());
925                                         case T_short:   return Constant.fromValue(left.charValue() - right.shortValue());
926                                         case T_int:             return Constant.fromValue(left.charValue() - right.intValue());
927                                         case T_long:    return Constant.fromValue(left.charValue() - right.longValue());
928                                 }
929                         break;
930                         case T_float :
931                                 switch (rightId){
932                                         case T_char :   return Constant.fromValue(left.floatValue() - right.charValue());
933                                         case T_float:   return Constant.fromValue(left.floatValue() - right.floatValue());
934                                         case T_double:  return Constant.fromValue(left.floatValue() - right.doubleValue());
935                                         case T_byte:    return Constant.fromValue(left.floatValue() - right.byteValue());
936                                         case T_short:   return Constant.fromValue(left.floatValue() - right.shortValue());
937                                         case T_int:             return Constant.fromValue(left.floatValue() - right.intValue());
938                                         case T_long:    return Constant.fromValue(left.floatValue() - right.longValue());
939                                 }
940                         break;
941                         case T_double :
942                                 switch (rightId){
943                                         case T_char :   return Constant.fromValue(left.doubleValue() - right.charValue());
944                                         case T_float:   return Constant.fromValue(left.doubleValue() - right.floatValue());
945                                         case T_double:  return Constant.fromValue(left.doubleValue() - right.doubleValue());
946                                         case T_byte:    return Constant.fromValue(left.doubleValue() - right.byteValue());
947                                         case T_short:   return Constant.fromValue(left.doubleValue() - right.shortValue());
948                                         case T_int:             return Constant.fromValue(left.doubleValue() - right.intValue());
949                                         case T_long:    return Constant.fromValue(left.doubleValue() - right.longValue());
950                                 }
951                         break;
952                         case T_byte :
953                                 switch (rightId){
954                                         case T_char :   return Constant.fromValue(left.byteValue() - right.charValue());
955                                         case T_float:   return Constant.fromValue(left.byteValue() - right.floatValue());
956                                         case T_double:  return Constant.fromValue(left.byteValue() - right.doubleValue());
957                                         case T_byte:    return Constant.fromValue(left.byteValue() - right.byteValue());
958                                         case T_short:   return Constant.fromValue(left.byteValue() - right.shortValue());
959                                         case T_int:             return Constant.fromValue(left.byteValue() - right.intValue());
960                                         case T_long:    return Constant.fromValue(left.byteValue() - right.longValue());
961                                 }
962                         break;                  
963                         case T_short :
964                                 switch (rightId){
965                                         case T_char :   return Constant.fromValue(left.shortValue() - right.charValue());
966                                         case T_float:   return Constant.fromValue(left.shortValue() - right.floatValue());
967                                         case T_double:  return Constant.fromValue(left.shortValue() - right.doubleValue());
968                                         case T_byte:    return Constant.fromValue(left.shortValue() - right.byteValue());
969                                         case T_short:   return Constant.fromValue(left.shortValue() - right.shortValue());
970                                         case T_int:             return Constant.fromValue(left.shortValue() - right.intValue());
971                                         case T_long:    return Constant.fromValue(left.shortValue() - right.longValue());
972                                 }
973                         break;
974                         case T_int :
975                                 switch (rightId){
976                                         case T_char :   return Constant.fromValue(left.intValue() - right.charValue());
977                                         case T_float:   return Constant.fromValue(left.intValue() - right.floatValue());
978                                         case T_double:  return Constant.fromValue(left.intValue() - right.doubleValue());
979                                         case T_byte:    return Constant.fromValue(left.intValue() - right.byteValue());
980                                         case T_short:   return Constant.fromValue(left.intValue() - right.shortValue());
981                                         case T_int:             return Constant.fromValue(left.intValue() - right.intValue());
982                                         case T_long:    return Constant.fromValue(left.intValue() - right.longValue());
983                                 }
984                         break;          
985                         case T_long :
986                                 switch (rightId){
987                                         case T_char :   return Constant.fromValue(left.longValue() - right.charValue());
988                                         case T_float:   return Constant.fromValue(left.longValue() - right.floatValue());
989                                         case T_double:  return Constant.fromValue(left.longValue() - right.doubleValue());
990                                         case T_byte:    return Constant.fromValue(left.longValue() - right.byteValue());
991                                         case T_short:   return Constant.fromValue(left.longValue() - right.shortValue());
992                                         case T_int:             return Constant.fromValue(left.longValue() - right.intValue());
993                                         case T_long:    return Constant.fromValue(left.longValue() - right.longValue());
994                                 }
995                                 
996                         }
997                 
998                 return NotAConstant;
999         }
1000         
1001         public static final Constant computeConstantOperationMULTIPLY(Constant left, int leftId, Constant right, int rightId) {
1002         
1003                 switch (leftId){
1004                         case T_char :
1005                                 switch (rightId){
1006                                         case T_char :   return Constant.fromValue(left.charValue() * right.charValue());
1007                                         case T_float:   return Constant.fromValue(left.charValue() * right.floatValue());
1008                                         case T_double:  return Constant.fromValue(left.charValue() * right.doubleValue());
1009                                         case T_byte:    return Constant.fromValue(left.charValue() * right.byteValue());
1010                                         case T_short:   return Constant.fromValue(left.charValue() * right.shortValue());
1011                                         case T_int:             return Constant.fromValue(left.charValue() * right.intValue());
1012                                         case T_long:    return Constant.fromValue(left.charValue() * right.longValue());
1013                                 }
1014                         break;
1015                         case T_float :
1016                                 switch (rightId){
1017                                         case T_char :   return Constant.fromValue(left.floatValue() * right.charValue());
1018                                         case T_float:   return Constant.fromValue(left.floatValue() * right.floatValue());
1019                                         case T_double:  return Constant.fromValue(left.floatValue() * right.doubleValue());
1020                                         case T_byte:    return Constant.fromValue(left.floatValue() * right.byteValue());
1021                                         case T_short:   return Constant.fromValue(left.floatValue() * right.shortValue());
1022                                         case T_int:             return Constant.fromValue(left.floatValue() * right.intValue());
1023                                         case T_long:    return Constant.fromValue(left.floatValue() * right.longValue());
1024                                 }
1025                         break;
1026                         case T_double :
1027                                 switch (rightId){
1028                                         case T_char :   return Constant.fromValue(left.doubleValue() * right.charValue());
1029                                         case T_float:   return Constant.fromValue(left.doubleValue() * right.floatValue());
1030                                         case T_double:  return Constant.fromValue(left.doubleValue() * right.doubleValue());
1031                                         case T_byte:    return Constant.fromValue(left.doubleValue() * right.byteValue());
1032                                         case T_short:   return Constant.fromValue(left.doubleValue() * right.shortValue());
1033                                         case T_int:             return Constant.fromValue(left.doubleValue() * right.intValue());
1034                                         case T_long:    return Constant.fromValue(left.doubleValue() * right.longValue());
1035                                 }
1036                         break;
1037                         case T_byte :
1038                                 switch (rightId){
1039                                         case T_char :   return Constant.fromValue(left.byteValue() * right.charValue());
1040                                         case T_float:   return Constant.fromValue(left.byteValue() * right.floatValue());
1041                                         case T_double:  return Constant.fromValue(left.byteValue() * right.doubleValue());
1042                                         case T_byte:    return Constant.fromValue(left.byteValue() * right.byteValue());
1043                                         case T_short:   return Constant.fromValue(left.byteValue() * right.shortValue());
1044                                         case T_int:             return Constant.fromValue(left.byteValue() * right.intValue());
1045                                         case T_long:    return Constant.fromValue(left.byteValue() * right.longValue());
1046                                 }
1047                         break;
1048                         case T_short :
1049                                 switch (rightId){
1050                                         case T_char :   return Constant.fromValue(left.shortValue() * right.charValue());
1051                                         case T_float:   return Constant.fromValue(left.shortValue() * right.floatValue());
1052                                         case T_double:  return Constant.fromValue(left.shortValue() * right.doubleValue());
1053                                         case T_byte:    return Constant.fromValue(left.shortValue() * right.byteValue());
1054                                         case T_short:   return Constant.fromValue(left.shortValue() * right.shortValue());
1055                                         case T_int:             return Constant.fromValue(left.shortValue() * right.intValue());
1056                                         case T_long:    return Constant.fromValue(left.shortValue() * right.longValue());
1057                                 }
1058                         break;
1059                         case T_int :
1060                                 switch (rightId){
1061                                         case T_char :   return Constant.fromValue(left.intValue() * right.charValue());
1062                                         case T_float:   return Constant.fromValue(left.intValue() * right.floatValue());
1063                                         case T_double:  return Constant.fromValue(left.intValue() * right.doubleValue());
1064                                         case T_byte:    return Constant.fromValue(left.intValue() * right.byteValue());
1065                                         case T_short:   return Constant.fromValue(left.intValue() * right.shortValue());
1066                                         case T_int:             return Constant.fromValue(left.intValue() * right.intValue());
1067                                         case T_long:    return Constant.fromValue(left.intValue() * right.longValue());
1068                                 }
1069                         break;
1070                         case T_long :
1071                                 switch (rightId){
1072                                         case T_char :   return Constant.fromValue(left.longValue() * right.charValue());
1073                                         case T_float:   return Constant.fromValue(left.longValue() * right.floatValue());
1074                                         case T_double:  return Constant.fromValue(left.longValue() * right.doubleValue());
1075                                         case T_byte:    return Constant.fromValue(left.longValue() * right.byteValue());
1076                                         case T_short:   return Constant.fromValue(left.longValue() * right.shortValue());
1077                                         case T_int:             return Constant.fromValue(left.longValue() * right.intValue());
1078                                         case T_long:    return Constant.fromValue(left.longValue() * right.longValue());
1079                                 }
1080                         }
1081         
1082                 return NotAConstant;
1083         }
1084         
1085         public static final Constant computeConstantOperationOR(Constant left, int leftId, Constant right, int rightId) {
1086                 
1087                 switch (leftId){
1088                         case T_boolean :                return Constant.fromValue(left.booleanValue() | right.booleanValue());
1089                         case T_char :
1090                                 switch (rightId){
1091                                         case T_char :   return Constant.fromValue(left.charValue() | right.charValue());
1092                                         case T_byte:    return Constant.fromValue(left.charValue() | right.byteValue());
1093                                         case T_short:   return Constant.fromValue(left.charValue() | right.shortValue());
1094                                         case T_int:             return Constant.fromValue(left.charValue() | right.intValue());
1095                                         case T_long:    return Constant.fromValue(left.charValue() | right.longValue());
1096                                 }
1097                         break;
1098                         case T_byte :
1099                                 switch (rightId){
1100                                         case T_char :   return Constant.fromValue(left.byteValue() | right.charValue());
1101                                         case T_byte:    return Constant.fromValue(left.byteValue() | right.byteValue());
1102                                         case T_short:   return Constant.fromValue(left.byteValue() | right.shortValue());
1103                                         case T_int:             return Constant.fromValue(left.byteValue() | right.intValue());
1104                                         case T_long:    return Constant.fromValue(left.byteValue() | right.longValue());
1105                                 }
1106                         break;
1107                         case T_short :
1108                                 switch (rightId){
1109                                         case T_char :   return Constant.fromValue(left.shortValue() | right.charValue());
1110                                         case T_byte:    return Constant.fromValue(left.shortValue() | right.byteValue());
1111                                         case T_short:   return Constant.fromValue(left.shortValue() | right.shortValue());
1112                                         case T_int:             return Constant.fromValue(left.shortValue() | right.intValue());
1113                                         case T_long:    return Constant.fromValue(left.shortValue() | right.longValue());
1114                                 }
1115                         break;
1116                         case T_int :
1117                                 switch (rightId){
1118                                         case T_char :   return Constant.fromValue(left.intValue() | right.charValue());
1119                                         case T_byte:    return Constant.fromValue(left.intValue() | right.byteValue());
1120                                         case T_short:   return Constant.fromValue(left.intValue() | right.shortValue());
1121                                         case T_int:             return Constant.fromValue(left.intValue() | right.intValue());
1122                                         case T_long:    return Constant.fromValue(left.intValue() | right.longValue());
1123                                 }
1124                         break;
1125                         case T_long :
1126                                 switch (rightId){
1127                                         case T_char :   return Constant.fromValue(left.longValue() | right.charValue());
1128                                         case T_byte:    return Constant.fromValue(left.longValue() | right.byteValue());
1129                                         case T_short:   return Constant.fromValue(left.longValue() | right.shortValue());
1130                                         case T_int:             return Constant.fromValue(left.longValue() | right.intValue());
1131                                         case T_long:    return Constant.fromValue(left.longValue() | right.longValue());
1132                                 }
1133         
1134                         }       
1135         
1136                 return NotAConstant;
1137         }
1138         
1139         public static final Constant computeConstantOperationOR_OR(Constant left, int leftId, Constant right, int rightId) {
1140         
1141                 return Constant.fromValue(left.booleanValue() || right.booleanValue());
1142         }
1143                 
1144         public static final Constant computeConstantOperationPLUS(Constant left, int leftId, Constant right, int rightId) {
1145                 
1146                 switch (leftId){
1147                         case T_JavaLangObject :
1148                                 if (rightId == T_JavaLangString) {
1149                                         return Constant.fromValue(left.stringValue() + right.stringValue());
1150                                 }
1151                         case T_boolean :
1152                                 if (rightId == T_JavaLangString) {
1153                                         return Constant.fromValue(left.stringValue() + right.stringValue());
1154                                 }
1155                         break;
1156                         case T_char :
1157                                 switch (rightId){
1158                                         case T_char :   return Constant.fromValue(left.charValue() + right.charValue());
1159                                         case T_float:   return Constant.fromValue(left.charValue() + right.floatValue());
1160                                         case T_double:  return Constant.fromValue(left.charValue() + right.doubleValue());
1161                                         case T_byte:    return Constant.fromValue(left.charValue() + right.byteValue());
1162                                         case T_short:   return Constant.fromValue(left.charValue() + right.shortValue());
1163                                         case T_int:             return Constant.fromValue(left.charValue() + right.intValue());
1164                                         case T_long:    return Constant.fromValue(left.charValue() + right.longValue());
1165                                         case T_JavaLangString:  return Constant.fromValue(left.stringValue() + right.stringValue());
1166                                 }
1167                         break;
1168                         case T_float :
1169                                 switch (rightId){
1170                                         case T_char :   return Constant.fromValue(left.floatValue() + right.charValue());
1171                                         case T_float:   return Constant.fromValue(left.floatValue() + right.floatValue());
1172                                         case T_double:  return Constant.fromValue(left.floatValue() + right.doubleValue());
1173                                         case T_byte:    return Constant.fromValue(left.floatValue() + right.byteValue());
1174                                         case T_short:   return Constant.fromValue(left.floatValue() + right.shortValue());
1175                                         case T_int:             return Constant.fromValue(left.floatValue() + right.intValue());
1176                                         case T_long:    return Constant.fromValue(left.floatValue() + right.longValue());
1177                                         case T_JavaLangString:  return Constant.fromValue(left.stringValue() + right.stringValue()); 
1178                                 }
1179                         break;
1180                         case T_double :
1181                                 switch (rightId){
1182                                         case T_char :   return Constant.fromValue(left.doubleValue() + right.charValue());
1183                                         case T_float:   return Constant.fromValue(left.doubleValue() + right.floatValue());
1184                                         case T_double:  return Constant.fromValue(left.doubleValue() + right.doubleValue());
1185                                         case T_byte:    return Constant.fromValue(left.doubleValue() + right.byteValue());
1186                                         case T_short:   return Constant.fromValue(left.doubleValue() + right.shortValue());
1187                                         case T_int:             return Constant.fromValue(left.doubleValue() + right.intValue());
1188                                         case T_long:    return Constant.fromValue(left.doubleValue() + right.longValue());
1189                                         case T_JavaLangString:  return Constant.fromValue(left.stringValue() + right.stringValue());
1190                                 }
1191                         break;
1192                         case T_byte :
1193                                 switch (rightId){
1194                                         case T_char :   return Constant.fromValue(left.byteValue() + right.charValue());
1195                                         case T_float:   return Constant.fromValue(left.byteValue() + right.floatValue());
1196                                         case T_double:  return Constant.fromValue(left.byteValue() + right.doubleValue());
1197                                         case T_byte:    return Constant.fromValue(left.byteValue() + right.byteValue());
1198                                         case T_short:   return Constant.fromValue(left.byteValue() + right.shortValue());
1199                                         case T_int:             return Constant.fromValue(left.byteValue() + right.intValue());
1200                                         case T_long:    return Constant.fromValue(left.byteValue() + right.longValue());
1201                                         case T_JavaLangString:  return Constant.fromValue(left.stringValue() + right.stringValue()); 
1202                                 }
1203         
1204                         break;                  
1205                         case T_short :
1206                                 switch (rightId){
1207                                         case T_char :   return Constant.fromValue(left.shortValue() + right.charValue());
1208                                         case T_float:   return Constant.fromValue(left.shortValue() + right.floatValue());
1209                                         case T_double:  return Constant.fromValue(left.shortValue() + right.doubleValue());
1210                                         case T_byte:    return Constant.fromValue(left.shortValue() + right.byteValue());
1211                                         case T_short:   return Constant.fromValue(left.shortValue() + right.shortValue());
1212                                         case T_int:             return Constant.fromValue(left.shortValue() + right.intValue());
1213                                         case T_long:    return Constant.fromValue(left.shortValue() + right.longValue());
1214                                         case T_JavaLangString:  return Constant.fromValue(left.stringValue() + right.stringValue());
1215                                 }
1216                         break;
1217                         case T_int :
1218                                 switch (rightId){
1219                                         case T_char :   return Constant.fromValue(left.intValue() + right.charValue());
1220                                         case T_float:   return Constant.fromValue(left.intValue() + right.floatValue());
1221                                         case T_double:  return Constant.fromValue(left.intValue() + right.doubleValue());
1222                                         case T_byte:    return Constant.fromValue(left.intValue() + right.byteValue());
1223                                         case T_short:   return Constant.fromValue(left.intValue() + right.shortValue());
1224                                         case T_int:             return Constant.fromValue(left.intValue() + right.intValue());
1225                                         case T_long:    return Constant.fromValue(left.intValue() + right.longValue());
1226                                         case T_JavaLangString:  return Constant.fromValue(left.stringValue() + right.stringValue());
1227                                 }
1228                         break;          
1229                         case T_long :
1230                                 switch (rightId){
1231                                         case T_char :   return Constant.fromValue(left.longValue() + right.charValue());
1232                                         case T_float:   return Constant.fromValue(left.longValue() + right.floatValue());
1233                                         case T_double:  return Constant.fromValue(left.longValue() + right.doubleValue());
1234                                         case T_byte:    return Constant.fromValue(left.longValue() + right.byteValue());
1235                                         case T_short:   return Constant.fromValue(left.longValue() + right.shortValue());
1236                                         case T_int:             return Constant.fromValue(left.longValue() + right.intValue());
1237                                         case T_long:    return Constant.fromValue(left.longValue() + right.longValue());
1238                                         case T_JavaLangString:  return Constant.fromValue(left.stringValue() + right.stringValue()); 
1239                                 }
1240                         break;
1241                         case T_JavaLangString :
1242                                 switch (rightId){
1243                                         case T_char :   return Constant.fromValue(left.stringValue() + right.stringValue());
1244                                         case T_float:   return Constant.fromValue(left.stringValue() + right.stringValue());
1245                                         case T_double:  return Constant.fromValue(left.stringValue() + right.stringValue());
1246                                         case T_byte:    return Constant.fromValue(left.stringValue() + right.stringValue());
1247                                         case T_short:   return Constant.fromValue(left.stringValue() + right.stringValue());
1248                                         case T_int:             return Constant.fromValue(left.stringValue() + right.stringValue());
1249                                         case T_long:    return Constant.fromValue(left.stringValue() + right.stringValue());
1250                                         case T_JavaLangString:  return Constant.fromValue(left.stringValue() + right.stringValue()); 
1251                                         case T_boolean: return Constant.fromValue(left.stringValue() + right.stringValue());
1252                                 }
1253                         break;  
1254                         case T_null :
1255                                 switch (rightId){
1256                                         case T_char :   return Constant.fromValue(left.stringValue() + right.stringValue());
1257                                         case T_float:   return Constant.fromValue(left.stringValue() + right.stringValue());
1258                                         case T_double:  return Constant.fromValue(left.stringValue() + right.stringValue());
1259                                         case T_byte:    return Constant.fromValue(left.stringValue() + right.stringValue());
1260                                         case T_short:   return Constant.fromValue(left.stringValue() + right.stringValue());
1261                                         case T_int:             return Constant.fromValue(left.stringValue() + right.stringValue());
1262                                         case T_long:    return Constant.fromValue(left.stringValue() + right.stringValue());
1263                                         case T_JavaLangString:  return Constant.fromValue(left.stringValue() + right.stringValue()); 
1264                                 }
1265                                 
1266                         }
1267                 
1268                 return NotAConstant;
1269         }
1270                 
1271         public static final Constant computeConstantOperationREMAINDER(Constant left, int leftId, Constant right, int rightId) {
1272                 
1273                 switch (leftId){
1274                         case T_char : 
1275                                 switch (rightId){
1276                                         case T_char :   return Constant.fromValue(left.charValue() % right.charValue());
1277                                         case T_float:   return Constant.fromValue(left.charValue() % right.floatValue());
1278                                         case T_double:  return Constant.fromValue(left.charValue() % right.doubleValue());
1279                                         case T_byte:    return Constant.fromValue(left.charValue() % right.byteValue());
1280                                         case T_short:   return Constant.fromValue(left.charValue() % right.shortValue());
1281                                         case T_int:             return Constant.fromValue(left.charValue() % right.intValue());
1282                                         case T_long:    return Constant.fromValue(left.charValue() % right.longValue());
1283                                 }
1284                         break;
1285                         case T_float :
1286                                 switch (rightId){
1287                                         case T_char :   return Constant.fromValue(left.floatValue() % right.charValue());
1288                                         case T_float:   return Constant.fromValue(left.floatValue() % right.floatValue());
1289                                         case T_double:  return Constant.fromValue(left.floatValue() % right.doubleValue());
1290                                         case T_byte:    return Constant.fromValue(left.floatValue() % right.byteValue());
1291                                         case T_short:   return Constant.fromValue(left.floatValue() % right.shortValue());
1292                                         case T_int:             return Constant.fromValue(left.floatValue() % right.intValue());
1293                                         case T_long:    return Constant.fromValue(left.floatValue() % right.longValue());
1294                                 }
1295                         break;
1296                         case T_double :
1297                                 switch (rightId){
1298                                         case T_char :   return Constant.fromValue(left.doubleValue() % right.charValue());
1299                                         case T_float:   return Constant.fromValue(left.doubleValue() % right.floatValue());
1300                                         case T_double:  return Constant.fromValue(left.doubleValue() % right.doubleValue());
1301                                         case T_byte:    return Constant.fromValue(left.doubleValue() % right.byteValue());
1302                                         case T_short:   return Constant.fromValue(left.doubleValue() % right.shortValue());
1303                                         case T_int:             return Constant.fromValue(left.doubleValue() % right.intValue());
1304                                         case T_long:    return Constant.fromValue(left.doubleValue() % right.longValue());
1305                                 }
1306                         break;
1307                         case T_byte :
1308                                 switch (rightId){
1309                                         case T_char :   return Constant.fromValue(left.byteValue() % right.charValue());
1310                                         case T_float:   return Constant.fromValue(left.byteValue() % right.floatValue());
1311                                         case T_double:  return Constant.fromValue(left.byteValue() % right.doubleValue());
1312                                         case T_byte:    return Constant.fromValue(left.byteValue() % right.byteValue());
1313                                         case T_short:   return Constant.fromValue(left.byteValue() % right.shortValue());
1314                                         case T_int:             return Constant.fromValue(left.byteValue() % right.intValue());
1315                                         case T_long:    return Constant.fromValue(left.byteValue() % right.longValue());
1316                                 }
1317                         break;                  
1318                         case T_short :
1319                                 switch (rightId){
1320                                         case T_char :   return Constant.fromValue(left.shortValue() % right.charValue());
1321                                         case T_float:   return Constant.fromValue(left.shortValue() % right.floatValue());
1322                                         case T_double:  return Constant.fromValue(left.shortValue() % right.doubleValue());
1323                                         case T_byte:    return Constant.fromValue(left.shortValue() % right.byteValue());
1324                                         case T_short:   return Constant.fromValue(left.shortValue() % right.shortValue());
1325                                         case T_int:             return Constant.fromValue(left.shortValue() % right.intValue());
1326                                         case T_long:    return Constant.fromValue(left.shortValue() % right.longValue());
1327                                 }
1328                         break;
1329                         case T_int :
1330                                 switch (rightId){
1331                                         case T_char :   return Constant.fromValue(left.intValue() % right.charValue());
1332                                         case T_float:   return Constant.fromValue(left.intValue() % right.floatValue());
1333                                         case T_double:  return Constant.fromValue(left.intValue() % right.doubleValue());
1334                                         case T_byte:    return Constant.fromValue(left.intValue() % right.byteValue());
1335                                         case T_short:   return Constant.fromValue(left.intValue() % right.shortValue());
1336                                         case T_int:             return Constant.fromValue(left.intValue() % right.intValue());
1337                                         case T_long:    return Constant.fromValue(left.intValue() % right.longValue());
1338                                 }
1339                         break;          
1340                         case T_long :
1341                                 switch (rightId){
1342                                         case T_char :   return Constant.fromValue(left.longValue() % right.charValue());
1343                                         case T_float:   return Constant.fromValue(left.longValue() % right.floatValue());
1344                                         case T_double:  return Constant.fromValue(left.longValue() % right.doubleValue());
1345                                         case T_byte:    return Constant.fromValue(left.longValue() % right.byteValue());
1346                                         case T_short:   return Constant.fromValue(left.longValue() % right.shortValue());
1347                                         case T_int:             return Constant.fromValue(left.longValue() % right.intValue());
1348                                         case T_long:    return Constant.fromValue(left.longValue() % right.longValue());
1349                                 }
1350                                 
1351                         }
1352                 
1353                 return NotAConstant;
1354         } 
1355         
1356         public static final Constant computeConstantOperationRIGHT_SHIFT(Constant left, int leftId, Constant right, int rightId) {
1357                 
1358                 switch (leftId){
1359                         case T_char :
1360                                 switch (rightId){
1361                                         case T_char :   return Constant.fromValue(left.charValue() >> right.charValue());
1362                                         case T_byte:    return Constant.fromValue(left.charValue() >> right.byteValue());
1363                                         case T_short:   return Constant.fromValue(left.charValue() >> right.shortValue());
1364                                         case T_int:             return Constant.fromValue(left.charValue() >> right.intValue());
1365                                         case T_long:    return Constant.fromValue(left.charValue() >> right.longValue());
1366                                 }
1367                         break;
1368                         case T_byte :
1369                                 switch (rightId){
1370                                         case T_char :   return Constant.fromValue(left.byteValue() >> right.charValue());
1371                                         case T_byte:    return Constant.fromValue(left.byteValue() >> right.byteValue());
1372                                         case T_short:   return Constant.fromValue(left.byteValue() >> right.shortValue());
1373                                         case T_int:             return Constant.fromValue(left.byteValue() >> right.intValue());
1374                                         case T_long:    return Constant.fromValue(left.byteValue() >> right.longValue());
1375                                 }
1376                         break;
1377                         case T_short :
1378                                 switch (rightId){
1379                                         case T_char :   return Constant.fromValue(left.shortValue() >> right.charValue());
1380                                         case T_byte:    return Constant.fromValue(left.shortValue() >> right.byteValue());
1381                                         case T_short:   return Constant.fromValue(left.shortValue() >> right.shortValue());
1382                                         case T_int:             return Constant.fromValue(left.shortValue() >> right.intValue());
1383                                         case T_long:    return Constant.fromValue(left.shortValue() >> right.longValue());
1384                                 }
1385                         break;
1386                         case T_int :
1387                                 switch (rightId){
1388                                         case T_char :   return Constant.fromValue(left.intValue() >> right.charValue());
1389                                         case T_byte:    return Constant.fromValue(left.intValue() >> right.byteValue());
1390                                         case T_short:   return Constant.fromValue(left.intValue() >> right.shortValue());
1391                                         case T_int:             return Constant.fromValue(left.intValue() >> right.intValue());
1392                                         case T_long:    return Constant.fromValue(left.intValue() >> right.longValue());
1393                                 }
1394                         break;
1395                         case T_long :
1396                                 switch (rightId){
1397                                         case T_char :   return Constant.fromValue(left.longValue() >> right.charValue());
1398                                         case T_byte:    return Constant.fromValue(left.longValue() >> right.byteValue());
1399                                         case T_short:   return Constant.fromValue(left.longValue() >> right.shortValue());
1400                                         case T_int:             return Constant.fromValue(left.longValue() >> right.intValue());
1401                                         case T_long:    return Constant.fromValue(left.longValue() >> right.longValue());
1402                                 }
1403         
1404                         }
1405                 
1406                 return NotAConstant;
1407         }
1408
1409         public static final Constant computeConstantOperationUNSIGNED_RIGHT_SHIFT(Constant left, int leftId, Constant right, int rightId) {
1410                 
1411                 switch (leftId){
1412                         case T_char :
1413                                 switch (rightId){
1414                                         case T_char :   return Constant.fromValue(left.charValue() >>> right.charValue());
1415                                         case T_byte:    return Constant.fromValue(left.charValue() >>> right.byteValue());
1416                                         case T_short:   return Constant.fromValue(left.charValue() >>> right.shortValue());
1417                                         case T_int:             return Constant.fromValue(left.charValue() >>> right.intValue());
1418                                         case T_long:    return Constant.fromValue(left.charValue() >>> right.longValue());
1419                                 }
1420                         break;
1421                         case T_byte :
1422                                 switch (rightId){
1423                                         case T_char :   return Constant.fromValue(left.byteValue() >>> right.charValue());
1424                                         case T_byte:    return Constant.fromValue(left.byteValue() >>> right.byteValue());
1425                                         case T_short:   return Constant.fromValue(left.byteValue() >>> right.shortValue());
1426                                         case T_int:             return Constant.fromValue(left.byteValue() >>> right.intValue());
1427                                         case T_long:    return Constant.fromValue(left.byteValue() >>> right.longValue());
1428                                 }
1429                         break;
1430                         case T_short :
1431                                 switch (rightId){
1432                                         case T_char :   return Constant.fromValue(left.shortValue() >>> right.charValue());
1433                                         case T_byte:    return Constant.fromValue(left.shortValue() >>> right.byteValue());
1434                                         case T_short:   return Constant.fromValue(left.shortValue() >>> right.shortValue());
1435                                         case T_int:             return Constant.fromValue(left.shortValue() >>> right.intValue());
1436                                         case T_long:    return Constant.fromValue(left.shortValue() >>> right.longValue());
1437                                 }
1438                         break;
1439                         case T_int :
1440                                 switch (rightId){
1441                                         case T_char :   return Constant.fromValue(left.intValue() >>> right.charValue());
1442                                         case T_byte:    return Constant.fromValue(left.intValue() >>> right.byteValue());
1443                                         case T_short:   return Constant.fromValue(left.intValue() >>> right.shortValue());
1444                                         case T_int:             return Constant.fromValue(left.intValue() >>> right.intValue());
1445                                         case T_long:    return Constant.fromValue(left.intValue() >>> right.longValue());
1446                                 }
1447                         break;
1448                         case T_long :
1449                                 switch (rightId){
1450                                         case T_char :   return Constant.fromValue(left.longValue() >>> right.charValue());
1451                                         case T_byte:    return Constant.fromValue(left.longValue() >>> right.byteValue());
1452                                         case T_short:   return Constant.fromValue(left.longValue() >>> right.shortValue());
1453                                         case T_int:             return Constant.fromValue(left.longValue() >>> right.intValue());
1454                                         case T_long:    return Constant.fromValue(left.longValue() >>> right.longValue());
1455                                 }
1456         
1457                         }
1458         
1459                 return NotAConstant;
1460         }
1461         
1462         public static final Constant computeConstantOperationXOR(Constant left, int leftId, Constant right, int rightId) {
1463                 
1464                 switch (leftId){
1465                         case T_boolean :                return Constant.fromValue(left.booleanValue() ^ right.booleanValue());
1466                         case T_char :
1467                                 switch (rightId){
1468                                         case T_char :   return Constant.fromValue(left.charValue() ^ right.charValue());
1469                                         case T_byte:    return Constant.fromValue(left.charValue() ^ right.byteValue());
1470                                         case T_short:   return Constant.fromValue(left.charValue() ^ right.shortValue());
1471                                         case T_int:             return Constant.fromValue(left.charValue() ^ right.intValue());
1472                                         case T_long:    return Constant.fromValue(left.charValue() ^ right.longValue());
1473                                 }
1474                         break;
1475                         case T_byte :
1476                                 switch (rightId){
1477                                         case T_char :   return Constant.fromValue(left.byteValue() ^ right.charValue());
1478                                         case T_byte:    return Constant.fromValue(left.byteValue() ^ right.byteValue());
1479                                         case T_short:   return Constant.fromValue(left.byteValue() ^ right.shortValue());
1480                                         case T_int:             return Constant.fromValue(left.byteValue() ^ right.intValue());
1481                                         case T_long:    return Constant.fromValue(left.byteValue() ^ right.longValue());
1482                                 }
1483                         break;
1484                         case T_short :
1485                                 switch (rightId){
1486                                         case T_char :   return Constant.fromValue(left.shortValue() ^ right.charValue());
1487                                         case T_byte:    return Constant.fromValue(left.shortValue() ^ right.byteValue());
1488                                         case T_short:   return Constant.fromValue(left.shortValue() ^ right.shortValue());
1489                                         case T_int:             return Constant.fromValue(left.shortValue() ^ right.intValue());
1490                                         case T_long:    return Constant.fromValue(left.shortValue() ^ right.longValue());
1491                                 }
1492                         break;
1493                         case T_int :
1494                                 switch (rightId){
1495                                         case T_char :   return Constant.fromValue(left.intValue() ^ right.charValue());
1496                                         case T_byte:    return Constant.fromValue(left.intValue() ^ right.byteValue());
1497                                         case T_short:   return Constant.fromValue(left.intValue() ^ right.shortValue());
1498                                         case T_int:             return Constant.fromValue(left.intValue() ^ right.intValue());
1499                                         case T_long:    return Constant.fromValue(left.intValue() ^ right.longValue());
1500                                 }
1501                         break;
1502                         case T_long :
1503                                 switch (rightId){
1504                                         case T_char :   return Constant.fromValue(left.longValue() ^ right.charValue());
1505                                         case T_byte:    return Constant.fromValue(left.longValue() ^ right.byteValue());
1506                                         case T_short:   return Constant.fromValue(left.longValue() ^ right.shortValue());
1507                                         case T_int:             return Constant.fromValue(left.longValue() ^ right.intValue());
1508                                         case T_long:    return Constant.fromValue(left.longValue() ^ right.longValue());
1509                                 }
1510                         }
1511         
1512                 return NotAConstant;
1513         }
1514
1515         public double doubleValue() {
1516
1517                 throw new ShouldNotImplement(Util.bind("constant.cannotCastedInto",typeName(),"double")); //$NON-NLS-2$ //$NON-NLS-1$
1518         }
1519
1520         public float floatValue() {
1521
1522                 throw new ShouldNotImplement(Util.bind("constant.cannotCastedInto",typeName(),"float")); //$NON-NLS-2$ //$NON-NLS-1$
1523         }
1524
1525         public static Constant fromValue(byte value) {
1526
1527                 return new ByteConstant(value);
1528         }
1529
1530         public static Constant fromValue(char value) {
1531
1532                 return new CharConstant(value);
1533         }
1534
1535         public static Constant fromValue(double value) {
1536
1537                 return new DoubleConstant(value);
1538         }
1539
1540         public static Constant fromValue(float value) {
1541
1542                 return new FloatConstant(value);
1543         }
1544
1545         public static Constant fromValue(int value) {
1546
1547                 return new IntConstant(value);
1548         }
1549
1550         public static Constant fromValue(long value) {
1551
1552                 return new LongConstant(value);
1553         }
1554
1555         public static Constant fromValue(String value) {
1556                 
1557                 return new StringConstant(value);
1558         }
1559
1560         public static Constant fromValue(short value) {
1561
1562                 return new ShortConstant(value);
1563         }
1564
1565         public static Constant fromValue(boolean value) {
1566
1567                 return new BooleanConstant(value);
1568         }
1569
1570         public int intValue() {
1571
1572                 throw new ShouldNotImplement(Util.bind("constant.cannotCastedInto",typeName(),"int")); //$NON-NLS-2$ //$NON-NLS-1$
1573         }
1574
1575         public long longValue() {
1576
1577                 throw new ShouldNotImplement(Util.bind("constant.cannotCastedInto",typeName(),"long")); //$NON-NLS-2$ //$NON-NLS-1$
1578         }
1579
1580         public short shortValue() {
1581
1582                 throw new ShouldNotImplement(Util.bind("constant.cannotConvertedTo",typeName(),"short")); //$NON-NLS-2$ //$NON-NLS-1$
1583         }
1584
1585         public String stringValue() {
1586
1587                 throw new ShouldNotImplement(Util.bind("constant.cannotConvertedTo",typeName(),"String")); //$NON-NLS-1$ //$NON-NLS-2$
1588         }
1589
1590         public String toString(){
1591         
1592                 if (this == NotAConstant) return "(Constant) NotAConstant"; //$NON-NLS-1$
1593                 return super.toString(); }
1594
1595         public abstract int typeID();
1596
1597         public String typeName() {
1598                 switch (typeID()) {
1599                         case T_int : return "int"; //$NON-NLS-1$
1600                         case T_byte : return "byte"; //$NON-NLS-1$
1601                         case T_short : return "short"; //$NON-NLS-1$
1602                         case T_char : return "char"; //$NON-NLS-1$
1603                         case T_float : return "float"; //$NON-NLS-1$
1604                         case T_double : return "double"; //$NON-NLS-1$
1605                         case T_boolean : return "boolean"; //$NON-NLS-1$
1606                         case T_long : return "long";//$NON-NLS-1$
1607                         case T_JavaLangString : return "java.lang.String"; //$NON-NLS-1$
1608                         case T_null : return "null";     //$NON-NLS-1$
1609                         default: return "unknown"; //$NON-NLS-1$
1610                 }
1611         }
1612 }