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 java.lang.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, java.lang.Object aLeftOperand, java.lang.Object aRightOperand)
Creates an instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.Object
evaluate()
Evaluates the whole node.protected abstract java.lang.Object
evaluateInternal(LEFT aLeftOperand, RIGHT aRightOperand)
Must be implemented by subclasses to implement the actual evaluation of this node.protected java.lang.Object
getEvaluatedLeftOperand()
Returns the left operand in an evaluated version.protected java.lang.Object
getEvaluatedRightOperand()
Returns the right operand in an evaluated version.
-
-
-
Constructor Detail
-
OperatorNode
public OperatorNode(Operation anOperation, java.lang.Object aLeftOperand, java.lang.Object aRightOperand)
Creates an instance.- Parameters:
aLeftOperand
- the left operandaRightOperand
- the right operand
-
-
Method Detail
-
getEvaluatedLeftOperand
protected java.lang.Object getEvaluatedLeftOperand() throws UnexecutableException
Returns the left operand in an evaluated version.- Returns:
- the result of the evaluation
- Throws:
UnexecutableException
-
getEvaluatedRightOperand
protected java.lang.Object getEvaluatedRightOperand() throws UnexecutableException
Returns the right operand in an evaluated version.- Returns:
- the result of the evaluation
- Throws:
UnexecutableException
-
evaluate
public java.lang.Object evaluate() throws UnexecutableException
Evaluates the whole node.- Returns:
- the evaluation result
- Throws:
UnexecutableException
-
evaluateInternal
protected abstract java.lang.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
-
-