public abstract class BinaryExpression extends Expression
A binary expression must always have a LHS. The RHS is optional.
Modifier and Type | Field and Description |
---|---|
protected Expression |
left |
protected Expression |
right |
Constructor and Description |
---|
BinaryExpression() |
Modifier and Type | Method and Description |
---|---|
Class |
getExpectedReturnType(Query q)
Return the expected return type from this expression.
|
Expression |
getLeft()
Get the LHS.
|
Expression |
getRight()
Get the RHS.
|
Object |
getValue(Object o,
Query q)
Get the value of this expression.
|
boolean |
hasFixedResult(Query q)
Return whether this expression, and more specifically the left and right parts of
the expression return a fixed result.
|
void |
init(Query q)
Init the expression.
|
void |
setLeft(Expression exp) |
void |
setRight(Expression exp) |
isBracketed, isTrue, setBracketed, toString
protected Expression left
protected Expression right
public boolean hasFixedResult(Query q)
hasFixedResult
in class Expression
q
- The Query object.true if the expression has a fixed result.
public Class getExpectedReturnType(Query q)
getExpectedReturnType
in class Expression
q
- The Query object.Boolean.class
.public void init(Query q) throws QueryParseException
Expression.init(Query)
on the LHS and RHS (if present) of the
expression.init
in class Expression
q
- The Query object.QueryParseException
- If the LHS and/or RHS cannot be inited.public Object getValue(Object o, Query q) throws QueryExecutionException
java.lang.Boolean
created as the result of a call to:
Expression.getValue(Object,Query)
.getValue
in class Expression
o
- The object to evaluate the expression on.q
- The Query object.QueryExecutionException
- If the expression cannot be evaluated.public Expression getRight()
public Expression getLeft()
public void setLeft(Expression exp)
public void setRight(Expression exp)