Class Expression
- java.lang.Object
-
- com.sun.tools.corba.ee.idl.constExpr.Expression
-
- Direct Known Subclasses:
BinaryExpr
,Terminal
,UnaryExpr
public abstract class Expression extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
_rep
String representation of this expression.private java.lang.String
_type
Computation type of this (sub)expression = Target type for now.private java.lang.Object
_value
Value of this expression: Boolean, Char, Byte, BigInteger, Double, String, Expression, ConstEntry.static java.math.BigInteger
llMax
static java.math.BigInteger
llMin
static java.math.BigInteger
lMax
static java.math.BigInteger
lMin
static java.math.BigInteger
negOne
static java.math.BigInteger
one
static java.math.BigInteger
sMax
static java.math.BigInteger
sMin
static java.math.BigInteger
two
static java.math.BigInteger
twoPow15
static java.math.BigInteger
twoPow16
static java.math.BigInteger
twoPow31
static java.math.BigInteger
twoPow32
static java.math.BigInteger
twoPow63
static java.math.BigInteger
twoPow64
static java.math.BigInteger
ullMax
static java.math.BigInteger
ullMin
static java.math.BigInteger
ulMax
static java.math.BigInteger
ulMin
static java.math.BigInteger
usMax
static java.math.BigInteger
usMin
static java.math.BigInteger
zero
-
Constructor Summary
Constructors Constructor Description Expression()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.Object
coerceToTarget(java.lang.Object obj)
Coerces a number to the target type of this expression.protected static java.lang.String
defaultType(java.lang.String targetType)
Return the default computation type for the given target type.abstract java.lang.Object
evaluate()
Compute the value of this expression.java.lang.String
rep()
Get the representation of this expression.void
rep(java.lang.String rep)
Set the representation of this expression.protected java.math.BigInteger
toSignedTarget(java.math.BigInteger b)
Coerces an integral value (BigInteger) to its corresponding signed representation, if the target type of this expression is signed.protected java.math.BigInteger
toUnsigned(java.math.BigInteger b)
Return the unsigned value of a BigInteger.protected java.math.BigInteger
toUnsignedTarget(java.math.BigInteger b)
Coerces an integral value (BigInteger) to its corresponding unsigned representation, if the target type of this expression is unsigned.java.lang.String
type()
Get the target type of this expression.void
type(java.lang.String type)
Set the target type of this expression.java.lang.Object
value()
Get the value of this expression.void
value(java.lang.Object value)
Set the value of this expression.
-
-
-
Field Detail
-
negOne
public static final java.math.BigInteger negOne
-
zero
public static final java.math.BigInteger zero
-
one
public static final java.math.BigInteger one
-
two
public static final java.math.BigInteger two
-
twoPow15
public static final java.math.BigInteger twoPow15
-
twoPow16
public static final java.math.BigInteger twoPow16
-
twoPow31
public static final java.math.BigInteger twoPow31
-
twoPow32
public static final java.math.BigInteger twoPow32
-
twoPow63
public static final java.math.BigInteger twoPow63
-
twoPow64
public static final java.math.BigInteger twoPow64
-
sMax
public static final java.math.BigInteger sMax
-
sMin
public static final java.math.BigInteger sMin
-
usMax
public static final java.math.BigInteger usMax
-
usMin
public static final java.math.BigInteger usMin
-
lMax
public static final java.math.BigInteger lMax
-
lMin
public static final java.math.BigInteger lMin
-
ulMax
public static final java.math.BigInteger ulMax
-
ulMin
public static final java.math.BigInteger ulMin
-
llMax
public static final java.math.BigInteger llMax
-
llMin
public static final java.math.BigInteger llMin
-
ullMax
public static final java.math.BigInteger ullMax
-
ullMin
public static final java.math.BigInteger ullMin
-
_value
private java.lang.Object _value
Value of this expression: Boolean, Char, Byte, BigInteger, Double, String, Expression, ConstEntry.
-
_rep
private java.lang.String _rep
String representation of this expression.
-
_type
private java.lang.String _type
Computation type of this (sub)expression = Target type for now.
-
-
Method Detail
-
evaluate
public abstract java.lang.Object evaluate() throws EvaluationException
Compute the value of this expression.- Throws:
EvaluationException
-
value
public void value(java.lang.Object value)
Set the value of this expression.
-
value
public java.lang.Object value()
Get the value of this expression.
-
rep
public void rep(java.lang.String rep)
Set the representation of this expression.
-
rep
public java.lang.String rep()
Get the representation of this expression.
-
type
public void type(java.lang.String type)
Set the target type of this expression.
-
type
public java.lang.String type()
Get the target type of this expression.
-
defaultType
protected static java.lang.String defaultType(java.lang.String targetType)
Return the default computation type for the given target type.
-
coerceToTarget
public java.lang.Object coerceToTarget(java.lang.Object obj)
Coerces a number to the target type of this expression.- Parameters:
obj
- The number to coerce.- Returns:
- the value of number coerced to the (target) type of this expression.
-
toUnsignedTarget
protected java.math.BigInteger toUnsignedTarget(java.math.BigInteger b)
Coerces an integral value (BigInteger) to its corresponding unsigned representation, if the target type of this expression is unsigned.- Parameters:
b
- The BigInteger to be coerced.- Returns:
- the value of an integral type coerced to its corresponding unsigned integral type, if the target type of this expression is unsigned.
-
toSignedTarget
protected java.math.BigInteger toSignedTarget(java.math.BigInteger b)
Coerces an integral value (BigInteger) to its corresponding signed representation, if the target type of this expression is signed.- Parameters:
b
- The BigInteger to be coerced.- Returns:
- the value of an integral type coerced to its corresponding signed integral type, if the target type of this expression is signed.
-
toUnsigned
protected java.math.BigInteger toUnsigned(java.math.BigInteger b)
Return the unsigned value of a BigInteger.
-
-