public class BinaryArithmeticExpression extends Object implements Expression
| Modifier and Type | Class and Description |
|---|---|
static class |
BinaryArithmeticExpression.Operator |
| Modifier and Type | Field and Description |
|---|---|
static BinaryArithmeticExpression.Operator |
OP_ADD |
static BinaryArithmeticExpression.Operator |
OP_DIV |
static BinaryArithmeticExpression.Operator |
OP_MUL |
static BinaryArithmeticExpression.Operator |
OP_SUB |
| Constructor and Description |
|---|
BinaryArithmeticExpression(Expression lhs,
BinaryArithmeticExpression.Operator op,
Expression rhs)
Creates a binary arithmetic expression by wrapping two expressions and
one operator.
|
| Modifier and Type | Method and Description |
|---|---|
Constant |
asConstant()
Return the evaluated constant value if both expressions are constant.
|
String |
asFieldName()
This method should never be called.
|
Constant |
evaluate(Record rec)
Evaluates the arithmetic expression by computing on the values from the
record.
|
boolean |
isApplicableTo(Schema sch)
Returns true if both expressions are in the specified schema.
|
boolean |
isConstant()
Returns true if both expressions are constant.
|
boolean |
isFieldName()
Returns false.
|
String |
toString() |
public static final BinaryArithmeticExpression.Operator OP_ADD
public static final BinaryArithmeticExpression.Operator OP_SUB
public static final BinaryArithmeticExpression.Operator OP_MUL
public static final BinaryArithmeticExpression.Operator OP_DIV
public BinaryArithmeticExpression(Expression lhs, BinaryArithmeticExpression.Operator op, Expression rhs)
lhs - the left hand side expressionop - the operatorrhs - the right hand side expressionpublic boolean isConstant()
isConstant in interface ExpressionExpression.isConstant()public boolean isFieldName()
isFieldName in interface ExpressionExpression.isFieldName()public Constant asConstant()
asConstant in interface ExpressionExpression.asConstant()public String asFieldName()
asFieldName in interface ExpressionExpression.asFieldName()public Constant evaluate(Record rec)
evaluate in interface Expressionrec - the recordExpression.evaluate(Record)public boolean isApplicableTo(Schema sch)
isApplicableTo in interface Expressionsch - the schemaExpression.isApplicableTo(Schema)Copyright © 2022 VanillaDB Organization. All rights reserved.