org.jfree.formula.operators

Interface InfixOperator

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
TypeValuePairevaluate(FormulaContext context, TypeValuePair value1, TypeValuePair value2)
Evaluates the comptuation for both parameters.
intgetLevel()
booleanisAssociative()
Defines, whether the operation is associative.
booleanisLeftOperation()
Defines the bind-direction of the operator.

Method Detail

evaluate

public TypeValuePair evaluate(FormulaContext context, TypeValuePair value1, TypeValuePair value2)
Evaluates the comptuation for both parameters. This method must never return null.

Parameters: context value1 value2

Returns:

Throws: EvaluationException

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