org.jfree.report.expressions
Interface Expression

All Superinterfaces:
java.lang.Cloneable, java.io.Serializable
All Known Subinterfaces:
Function
All Known Implementing Classes:
AbstractExpression, ColumnAggregationExpression, FormulaExpression, FormulaFunction, GetValueExpression, GroupByExpression, IsEmptyDataExpression, IsEmptyExpression, IsEndOfDataExpression, IsExportTypeExpression, IsNullExpression, SurveyScaleExpression

public interface Expression
extends java.lang.Cloneable, java.io.Serializable

An expression is a lightweight computation that does not maintain a state. Expressions are used to calculate values within a single row of a report. Expressions can use a dataRow to access other fields, expressions or functions within the current row in the report. Statefull computations can be implemented using functions.

Author:
Thomas Morgner
See Also:
Function

Method Summary
 java.lang.Object clone()
          Clones the expression, expression should be reinitialized after the cloning.
 java.lang.Object computeValue()
          Return the current expression value.
 Expression getInstance()
          Return a new instance of this expression.
 java.lang.String getName()
          Returns the name of the expression.
 boolean isDeepTraversing()
          A deep-traversing expression declares that it should receive updates from all subreports.
 boolean isPrecompute()
          Returns, whether the expression will be precomputed.
 boolean isPreserve()
          Checks, whether the expression's result should be preserved in the precomputed value registry.
 void setDeepTraversing(boolean deepTraversing)
          Defines, whether the expression is deep-traversing.
 void setName(java.lang.String name)
          Sets the name of the expression.
 void setPrecompute(boolean precompute)
          Defines, whether the expression will be precomputed.
 void setPreserve(boolean preserve)
          Defines, whether the expression's result should be preserved in the precomputed value registry.
 void setRuntime(ExpressionRuntime runtime)
          Defines the DataRow used in this expression.
 

Method Detail

getName

java.lang.String getName()
Returns the name of the expression. An expression without a name cannot be referenced from outside the element.

Returns:
the function name.

setName

void setName(java.lang.String name)
Sets the name of the expression.

Parameters:
name - the name.

computeValue

java.lang.Object computeValue()
                              throws DataSourceException
Return the current expression value.

The value depends (obviously) on the expression implementation.

Returns:
the value of the function.
Throws:
DataSourceException

clone

java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clones the expression, expression should be reinitialized after the cloning.

Expression maintain no state, cloning is done at the beginning of the report processing to disconnect the used expression from any other object space.

Returns:
A clone of this expression.
Throws:
java.lang.CloneNotSupportedException - this should never happen.

getInstance

Expression getInstance()
Return a new instance of this expression. The copy is initialized and uses the same parameters as the original, but does not share any objects.

Returns:
a copy of this function.

setRuntime

void setRuntime(ExpressionRuntime runtime)
Defines the DataRow used in this expression. The dataRow is set when the report processing starts and can be used to access the values of functions, expressions and the reports datasource.

Parameters:
runtime - the runtime information for the expression

isDeepTraversing

boolean isDeepTraversing()
A deep-traversing expression declares that it should receive updates from all subreports. This mode should be activated if the expression's result depends on values contained in the subreport.

Returns:
true, if the expression is deep-traversing, false otherwise.

setDeepTraversing

void setDeepTraversing(boolean deepTraversing)
Defines, whether the expression is deep-traversing.

Parameters:
deepTraversing - true, if the expression is deep-traversing, false otherwise.

isPrecompute

boolean isPrecompute()
Returns, whether the expression will be precomputed. For precomputed expressions a parallel evaluation process is started and the result to which the expression evaluates before it gets out of scope will be used whenever an other expression queries this expression's value.

Returns:
true, if the expression is precomputed, false otherwise.

setPrecompute

void setPrecompute(boolean precompute)
Defines, whether the expression will be precomputed. For precomputed expressions a parallel evaluation process is started and the result to which the expression evaluates before it gets out of scope will be used whenever an other expression queries this expression's value.

Parameters:
precompute - true, if the expression is precomputed, false otherwise.

isPreserve

boolean isPreserve()
Checks, whether the expression's result should be preserved in the precomputed value registry. This way, the last value for that expression can be retrieved after the report has been finished. The preserve-function will only preserve the last value that has been evaluated before the expression went out of scope.

Returns:
true, if the expression's results should be preserved, false otherwise.

setPreserve

void setPreserve(boolean preserve)
Defines, whether the expression's result should be preserved in the precomputed value registry. This way, the last value for that expression can be retrieved after the report has been finished.

Parameters:
preserve - true, if the expression's results should be preserved, false otherwise.