- Type Parameters:
R- the type of resources used as inputs.
V- the type of values computed by the expression.
- Enclosing class:
public static interface Optimization.OnExpression<R,
extends Expression<R, V>
Expression that can be optimized. Each expression implementation knows which rules can be applied. For that reason, the optimization algorithms are kept in each implementation class. This interface allows
Optimizationto invoke that code.
Implementations need to override only one of the 2 methods defined in this interface.
Method SummaryModifier and TypeMethodDescriptionTries to optimize this expression.Creates a new expression of the same type than this expression, but with optimized parameters.
optimizeTries to optimize this expression. The default implementation performs the following steps:
- If all expressions are literals, evaluate this expression immediately.
- Otherwise if at least one parameter can be optimized, recreate the expression.
- Otherwise returns
optimization- the simplifications or optimizations to apply on this expression.
- the simplified or optimized expression, or
thisif no optimization has been applied.
recreateCreates a new expression of the same type than this expression, but with optimized parameters. The expressions given to this method shall be equivalent to the expressions used by this instance, potentially more efficient.
This method is used by the default implementation of
optimize(Optimization)and can be ignored if above method is overridden.
effective- the expressions to use as a replacement of this expression parameters.
- the new expression, or