public class ArithmeticExpression extends ValueExpression
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
ADDITION |
static int |
DIVIDE |
static int |
MODULUS |
static int |
MULTIPLY |
static int |
SUBTRACT |
| 构造器和说明 |
|---|
ArithmeticExpression() |
| 限定符和类型 | 方法和说明 |
|---|---|
Object |
evaluate(Object o,
Query q)
Evaulate this expression.
|
Class |
getExpectedReturnType(Query q)
Return the expected return type.
|
ValueExpression |
getLeft()
Get the LHS value expression.
|
ValueExpression |
getRight()
Get the RHS value expression.
|
int |
getType() |
boolean |
hasFixedResult(Query q)
Return whether the expression will evaluate to a fixed/constant result.
|
void |
init(Query q)
Perform the necessary initialisation for this expression.
|
boolean |
isTrue(Object o,
Query q)
Determine whether this arithmetic expression evaluates to true.
|
void |
setLeft(ValueExpression exp) |
void |
setRight(ValueExpression exp) |
void |
setType(int t) |
String |
toString()
Return a string representation of the expression, making this abstract forces
sub-classes to provide an implementation.
|
getValueisBracketed, setBracketedpublic static final int MULTIPLY
public static final int ADDITION
public static final int SUBTRACT
public static final int DIVIDE
public static final int MODULUS
public Class getExpectedReturnType(Query q) throws QueryParseException
getExpectedReturnType 在类中 Expressionq - The Query object.QueryParseException - If something goes wrong in determining the return type.public boolean isTrue(Object o, Query q) throws QueryExecutionException
Thus the following could be performed:
SELECT 10 + 20 FROM java.lang.ObjectThe rules are as follows:
evaluate(Object,Query) returns null then false
is returned.evaluate(Object,Query) returns a number and it is greater than 0 then
true is returned. If it is 0 or less than 0
then false is returned.
true is returned.
isTrue 在类中 Expressiono - The object to perform the expression on.q - The Query object.QueryExecutionException - If something goes wrong during the evaluation of the
expression.public boolean hasFixedResult(Query q)
ExpressionExpression.isTrue(Object,Query) or Expression.getValue(Object,Query)
methods will return the same object (or that o1.equals (o2) == true)
regardless of the object passed to the method.hasFixedResult 在类中 Expressionq - The Query object.true if the expression evaluates to a fixed/constant result.public void init(Query q) throws QueryParseException
Expressioninit 在类中 Expressionq - The Query object.QueryParseException - If something goes wrong with the initialisation.public ValueExpression getRight()
public ValueExpression getLeft()
public void setLeft(ValueExpression exp)
public void setRight(ValueExpression exp)
public int getType()
public void setType(int t)
public Object evaluate(Object o, Query q) throws QueryExecutionException
java.lang.Number otherwise a QueryExecutionException is
thrown.
Special cases:
evaluate 在类中 ValueExpressiono - The object to perform the expression on.q - The Query object.QueryExecutionException - If an error occurs during processing.public String toString()
ExpressiontoString 在类中 ExpressionCopyright © 2021. All rights reserved.