|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bc.jexp.Term
public abstract class Term
The abstract Term class is an in-memory representation of an
element within an arbitrary expression tree. The class defines a number of
concrete Term implementations each representing either an
an atomic leave (number constant, symbol reference) or a node
(e.g. binary operator, function call) within an expression tree.
Instances of this class are normally created using an expression parser
which implements the interface.
The Parser class provides a default
implementation of such a parser.
ParserImpl
| Nested Class Summary | |
|---|---|
static class |
Term.Add
The numerical ADD operation: n-term + n-term
|
static class |
Term.AndB
The logical AND operation: b-term && b-term
|
static class |
Term.AndI
The bitwise AND operation: i-term & i-term
|
static class |
Term.Assign
The assignment operation variable-ref-term = term
|
static class |
Term.Binary
|
static class |
Term.BinaryB
An abstract binary (= 2 operands) operation. |
static class |
Term.BinaryI
An abstract binary (= 2 operands) operation with a return type of int. |
static class |
Term.BinaryN
An abstract binary (= 2 operands) operation with a numeric return type. |
static class |
Term.Call
A call of a (or reference to a) . |
static class |
Term.Cond
The conditional operation b-term ? |
static class |
Term.ConstB
A boolean constant, e.g. |
static class |
Term.ConstD
A floating point constant, e.g. |
static class |
Term.ConstI
An integer constant, e.g. |
static class |
Term.ConstS
|
static class |
Term.Div
The numerical DIV operation: n-term / n-term
|
static class |
Term.EqB
The boolean EQ operation: b-term == b-term
|
static class |
Term.EqD
The double EQ operation: d-term == d-term
|
static class |
Term.EqI
The integer EQ operation: i-term == i-term
|
static class |
Term.GeD
The double GE operation: d-term >= d-term
|
static class |
Term.GeI
The integer GE operation: i-term >= i-term
|
static class |
Term.GtD
The double GT operation: d-term > d-term
|
static class |
Term.GtI
The integer GT operation: i-term > i-term
|
static class |
Term.LeD
The double LE operation: d-term <= d-term
|
static class |
Term.LeI
The integer LE operation: i-term <= i-term
|
static class |
Term.LtD
The double LT operation: d-term < d-term
|
static class |
Term.LtI
The integer LT operation: i-term < i-term
|
static class |
Term.Mod
The numerical MOD (modulo) operation: n-term % n-term
|
static class |
Term.Mul
The numerical MUL operation: n-term * n-term
|
static class |
Term.Neg
The numerical NEG operation: - d-term
|
static class |
Term.NEqB
The boolean NEQ operation: b-term ! |
static class |
Term.NEqD
The double NEQ operation: d-term ! |
static class |
Term.NEqI
The integer NEQ operation: i-term ! |
static class |
Term.NotB
The logical NOT operation ! |
static class |
Term.NotI
The bitwise NOT operation: ~ i-term
|
static class |
Term.Op
An abstract operation. |
static class |
Term.OrB
The logical OR operation: b-term || b-term
|
static class |
Term.OrI
The bitwise OR operation: i-term | i-term
|
static class |
Term.Ref
A reference to a . |
static class |
Term.Sub
The numerical SUB operation: n-term - n-term
|
static class |
Term.Unary
An abstract unary (= 1 operand) operation. |
static class |
Term.UnaryB
An abstract unary (= 1 operand) operation with return type of boolean. |
static class |
Term.UnaryI
An abstract unary (= 1 operand) operation with return type of int. |
static class |
Term.UnaryN
An abstract unary (= 1 operand) operation with a numeric return type. |
static class |
Term.XOrI
The bitwise XOR operation: i-term ^ i-term
|
| Field Summary | |
|---|---|
static int |
TYPE_B
The ID for the boolean type. |
static int |
TYPE_D
The ID for the double type. |
static int |
TYPE_I
The ID for the int type. |
static int |
TYPE_S
The ID for the string type. |
| Constructor Summary | |
|---|---|
Term()
|
|
| Method Summary | |
|---|---|
abstract boolean |
evalB(EvalEnv context)
Evaluates this term to a boolean value. |
abstract double |
evalD(EvalEnv env)
Evaluates this term to a double value. |
abstract int |
evalI(EvalEnv env)
Evaluates this term to an int value. |
String |
evalS(EvalEnv env)
Evaluates this term to a String value. |
Term[] |
getChildren()
Returns an array of terms which are children of this term. |
abstract int |
getRetType()
Gets the term's "natural" return type. |
boolean |
isB()
Tests whether or not this term "naturally" returns a boolean. |
boolean |
isD()
Tests whether or not this term "naturally" returns a double. |
boolean |
isI()
Tests whether or not this term "naturally" returns an int. |
boolean |
isN()
Tests whether or not this term "naturally" returns a numeric value. |
static boolean |
toB(double value)
Converts a double to a boolean. |
static boolean |
toB(int value)
Converts an int to a boolean. |
static double |
toD(boolean value)
Converts a boolean to an double. |
static int |
toI(boolean value)
Converts a boolean to an int. |
static int |
toI(double value)
Converts a double to an int. |
static String |
toS(boolean value)
Converts a boolean to a String. |
static String |
toS(double value)
Converts a double to a String. |
static String |
toS(int value)
Converts a integer to a String. |
abstract String |
toString()
Returns a string representation of this term which can be used for debugging. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int TYPE_B
boolean type.
public static final int TYPE_I
int type.
public static final int TYPE_D
double type.
public static final int TYPE_S
string type.
| Constructor Detail |
|---|
public Term()
| Method Detail |
|---|
public abstract int getRetType()
TYPE_X constants
defined in this class.public abstract boolean evalB(EvalEnv context)
boolean value.
context - the application dependant environment.
boolean value
EvalException - if the evaluation failspublic abstract int evalI(EvalEnv env)
int value.
env - the application dependant environment.
int value
EvalException - if the evaluation failspublic abstract double evalD(EvalEnv env)
double value.
env - the application dependant environment.
double value
EvalException - if the evaluation failspublic String evalS(EvalEnv env)
String value.
The default implementation simply returns the value of toString().
env - the application dependant environment.
String value
EvalException - if the evaluation failspublic Term[] getChildren()
null but can be emptypublic abstract String toString()
toString in class Objectpublic final boolean isB()
boolean.
true if sopublic final boolean isI()
int.
true if sopublic final boolean isD()
double.
true if sopublic final boolean isN()
true if sopublic static boolean toB(int value)
int to a boolean.
value - the value to be converted
value != 0.public static boolean toB(double value)
double to a boolean.
value - the value to be converted
value != 0.0.public static int toI(boolean value)
boolean to an int.
value - the value to be converted
value ? 1 : 0.public static int toI(double value)
double to an int.
value - the value to be converted
(int) value.public static double toD(boolean value)
boolean to an double.
value - the value to be converted
value ? 1.0 : 0.0.public static String toS(boolean value)
boolean to a String.
value - the value to be converted
value ? 1.0 : 0.0.public static String toS(int value)
integer to a String.
value - the value to be converted
value ? 1.0 : 0.0.public static String toS(double value)
double to a String.
value - the value to be converted
value ? 1.0 : 0.0.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||