Class OperatorNode<LEFT,RIGHT>
- java.lang.Object
-
- de.gebit.integrity.operations.standard.operands.OperatorNode<LEFT,RIGHT>
-
- Type Parameters:
LEFT
- the left argumentRIGHT
- the right argument
- Direct Known Subclasses:
AdditionNode
,DivisionNode
,ModuloNode
,MultiplicationNode
,StringConcatenationNode
,SubtractionNode
public abstract class OperatorNode<LEFT,RIGHT> extends Object
Abstract base class for operator nodes. An operator node is a node in the AST built to evaluateStandardOperation
s.- Author:
- Rene Schneider - initial API and implementation
-
-
Constructor Summary
Constructors Constructor Description OperatorNode(Operation anOperation, Object aLeftOperand, Object aRightOperand)
Creates an instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Object
evaluate()
Evaluates the whole node.protected abstract Object
evaluateInternal(LEFT aLeftOperand, RIGHT aRightOperand)
Must be implemented by subclasses to implement the actual evaluation of this node.protected Object
getEvaluatedLeftOperand()
Returns the left operand in an evaluated version.protected Object
getEvaluatedRightOperand()
Returns the right operand in an evaluated version.
-
-
-
Method Detail
-
getEvaluatedLeftOperand
protected Object getEvaluatedLeftOperand() throws UnexecutableException
Returns the left operand in an evaluated version.- Returns:
- the result of the evaluation
- Throws:
UnexecutableException
-
getEvaluatedRightOperand
protected Object getEvaluatedRightOperand() throws UnexecutableException
Returns the right operand in an evaluated version.- Returns:
- the result of the evaluation
- Throws:
UnexecutableException
-
evaluate
public Object evaluate() throws UnexecutableException
Evaluates the whole node.- Returns:
- the evaluation result
- Throws:
UnexecutableException
-
evaluateInternal
protected abstract Object evaluateInternal(LEFT aLeftOperand, RIGHT aRightOperand) throws UnexecutableException
Must be implemented by subclasses to implement the actual evaluation of this node. It will get evaluated and converted operands and needs to return the result of the evaluation.- Parameters:
aLeftOperand
- the evaluated left operandaRightOperand
- the evaluated right operand- Returns:
- the result of the evaluation
- Throws:
UnexecutableException
-
-