public abstract class BinaryExpression extends Expression
leftValue
and rightValue
which, presumably, subclasses will call.
The current version is tied to arithmetic expressions via the the return type
of leftValue
and rightValue
.
Modifier and Type | Field and Description |
---|---|
protected Expression |
myLeft |
protected Expression |
myRight |
protected java.lang.String |
mySymbol |
gelementsToValue
Constructor and Description |
---|
BinaryExpression(Expression lhs,
Expression rhs)
construct a binary expression from two subexpressions
|
Modifier and Type | Method and Description |
---|---|
double |
leftValue(Context c) |
double |
rightValue(Context c) |
java.lang.String |
toString()
Combine left/right subexpressions, return result using symbol as the
combiner/juxtaposer for the subexpressions.
|
evaluate, value
protected java.lang.String mySymbol
protected Expression myLeft
protected Expression myRight
public BinaryExpression(Expression lhs, Expression rhs)
lhs
- is the left subexpression (left-hand side)rhs
- is the right subexpression (right-hand side)public double leftValue(Context c)
public double rightValue(Context c)
public java.lang.String toString()
toString
in class java.lang.Object