Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javafe.tc
Class ConstantExpr

    java.lang.Object
      javafe.tc.ConstantExpr

public class ConstantExpr
extends java.lang.Object

Constructor Summary
`ConstantExpr()`

Method Summary
`static boolean` | `constantValueFitsIn(java.lang.Object val, PrimitiveType t)`
`static java.lang.Object` | `eval(Expr e)` Evaluates a compile-time constant expression.
`private static java.lang.Object` | `evalBooleanBinaryOp(int op, java.lang.Object leftVal, java.lang.Object rightVal)`
`private static java.lang.Object` | `evalDoubleBinaryOp(int op, java.lang.Object leftVal, java.lang.Object rightVal)`
`private static java.lang.Object` | `evalFloatBinaryOp(int op, java.lang.Object leftVal, java.lang.Object rightVal)`
`private static java.lang.Object` | `evalIntBinaryOp(int op, java.lang.Object leftVal, java.lang.Object rightVal)`
`private static java.lang.Object` | `evalLongBinaryOp(int op, java.lang.Object leftVal, java.lang.Object rightVal)`
`private static boolean` | `getBooleanConstant(java.lang.Object c)`
`private static double` | `getDoubleConstant(java.lang.Object c)`
`private static float` | `getFloatConstant(java.lang.Object c)`
`static int` | `getIntConstant(java.lang.Object c)`
`static long` | `getLongConstant(java.lang.Object c)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ConstantExpr

    public ConstantExpr()

Method Detail

### constantValueFitsIn

    public static boolean constantValueFitsIn(java.lang.Object val,
                                              PrimitiveType t)

### eval

    public static java.lang.Object eval(Expr e)

  Evaluates a compile-time constant expression. Returns Integer, Long, Float, Double, Boolean, String or null (if the expression is not a constant.) The relation between the FlowInsensitiveChecks.getType(e), and the type of eval(e) is as follows:

       getType(e)          eval(e)

       boolean             Boolean or null
       byte                Integer or null    (*)
       short               Integer or null    (*)
       char                Integer or null    (*)
       int                 Integer or null
       long                Long or null
       float               Float or null
       double              Double or null
       String              String or null

  These will have been widened to int appropriately...

### evalIntBinaryOp

    private static java.lang.Object evalIntBinaryOp(int op,
                                                    java.lang.Object leftVal,
                                                    java.lang.Object rightVal)
                                             throws java.lang.ArithmeticException

  Throws:
    `java.lang.ArithmeticException`

### evalLongBinaryOp

    private static java.lang.Object evalLongBinaryOp(int op,
                                                     java.lang.Object leftVal,
                                                     java.lang.Object rightVal)
                                              throws java.lang.ArithmeticException

  Throws:
    `java.lang.ArithmeticException`

### evalBooleanBinaryOp

    private static java.lang.Object evalBooleanBinaryOp(int op,
                                                        java.lang.Object leftVal,
                                                        java.lang.Object rightVal)
                                                 throws java.lang.ArithmeticException

  Throws:
    `java.lang.ArithmeticException`

### evalFloatBinaryOp

    private static java.lang.Object evalFloatBinaryOp(int op,
                                                      java.lang.Object leftVal,
                                                      java.lang.Object rightVal)

### evalDoubleBinaryOp

    private static java.lang.Object evalDoubleBinaryOp(int op,
                                                       java.lang.Object leftVal,
                                                       java.lang.Object rightVal)

### getIntConstant

    public static int getIntConstant(java.lang.Object c)

### getLongConstant

    public static long getLongConstant(java.lang.Object c)

### getBooleanConstant

    private static boolean getBooleanConstant(java.lang.Object c)

### getFloatConstant

    private static float getFloatConstant(java.lang.Object c)

### getDoubleConstant

    private static double getDoubleConstant(java.lang.Object c)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

The ESC/Java2 Project Homepage