Interface InfixOperator
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AbstractCompareOperator
,AbstractNumericOperator
,AddOperator
,ConcatOperator
,DivideOperator
,EqualOperator
,GreaterEqualOperator
,GreaterOperator
,LesserEqualOperator
,LesserOperator
,MultiplyOperator
,NotEqualOperator
,PowerOperator
,SubtractOperator
public interface InfixOperator extends Serializable
An operator. An operator always takes two arguments. Prefix and postfix operators are implemented differently.- Author:
- Thomas Morgner
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TypeValuePair
evaluate(FormulaContext context, TypeValuePair value1, TypeValuePair value2)
Evaluates the comptuation for both parameters.int
getLevel()
boolean
isAssociative()
Defines, whether the operation is associative.boolean
isLeftOperation()
Defines the bind-direction of the operator.
-
-
-
Method Detail
-
evaluate
TypeValuePair evaluate(FormulaContext context, TypeValuePair value1, TypeValuePair value2) throws EvaluationException
Evaluates the comptuation for both parameters. This method must never return null.- Parameters:
context
-value1
-value2
-- Returns:
- Throws:
EvaluationException
-
getLevel
int getLevel()
-
isLeftOperation
boolean isLeftOperation()
Defines the bind-direction of the operator. That direction defines, in which direction a sequence of equal operators is resolved.- Returns:
- true, if the operation is left-binding, false if right-binding
-
isAssociative
boolean isAssociative()
Defines, whether the operation is associative. For associative operations, the evaluation order does not matter, if the operation appears more than once in an expression, and therefore we can optimize them a lot better than non-associative operations (ie. merge constant parts and precompute them once).- Returns:
- true, if the operation is associative, false otherwise
-
-