org.jfree.formula.operators

Interface InfixOperator

All Superinterfaces:
Serializable
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

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 Details

evaluate

public 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:

getLevel

public int getLevel()

isAssociative

public 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

isLeftOperation

public 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