org.jfree.report.expressions
Class AbstractExpression

java.lang.Object
  extended by org.jfree.report.expressions.AbstractExpression
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Expression
Direct Known Subclasses:
ColumnAggregationExpression, FormulaExpression, FormulaFunction, GetValueExpression, GroupByExpression, IsEmptyDataExpression, IsEmptyExpression, IsEndOfDataExpression, IsExportTypeExpression, IsNullExpression

public abstract class AbstractExpression
extends java.lang.Object
implements Expression

A baseclass for simple, non-positionally parametrized expressions.

Author:
Thomas Morgner
See Also:
Serialized Form

Constructor Summary
protected AbstractExpression()
           
 
Method Summary
 java.lang.Object clone()
          Clones the expression, expression should be reinitialized after the cloning.
protected  DataRow getDataRow()
          Returns the current DataRow.
 Expression getInstance()
          Return a new instance of this expression.
 java.lang.String getName()
          Returns the name of the expression.
protected  java.util.Locale getParentLocale()
           
protected  org.pentaho.reporting.libraries.base.config.Configuration getReportConfiguration()
           
protected  ResourceBundleFactory getResourceBundleFactory()
           
 ExpressionRuntime getRuntime()
           
 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.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jfree.report.expressions.Expression
computeValue
 

Constructor Detail

AbstractExpression

protected AbstractExpression()
Method Detail

getName

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

Specified by:
getName in interface Expression
Returns:
the function name.

setName

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

Specified by:
setName in interface Expression
Parameters:
name - the name.

clone

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

Specified by:
clone in interface Expression
Overrides:
clone in class java.lang.Object
Returns:
A clone of this expression.
Throws:
java.lang.CloneNotSupportedException - this should never happen.

getInstance

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

Specified by:
getInstance in interface Expression
Returns:
a copy of this function.

setRuntime

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

Specified by:
setRuntime in interface Expression
Parameters:
runtime - the runtime information for the expression

getRuntime

public ExpressionRuntime getRuntime()

getDataRow

protected DataRow getDataRow()
Returns the current DataRow.

Returns:
the data row.

getResourceBundleFactory

protected ResourceBundleFactory getResourceBundleFactory()

getReportConfiguration

protected org.pentaho.reporting.libraries.base.config.Configuration getReportConfiguration()

getParentLocale

protected java.util.Locale getParentLocale()

isPrecompute

public boolean isPrecompute()
Description copied from interface: Expression
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.

Specified by:
isPrecompute in interface Expression
Returns:
true, if the expression is precomputed, false otherwise.

setPrecompute

public void setPrecompute(boolean precompute)
Description copied from interface: Expression
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.

Specified by:
setPrecompute in interface Expression
Parameters:
precompute - true, if the expression is precomputed, false otherwise.

isDeepTraversing

public boolean isDeepTraversing()
Description copied from interface: Expression
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.

Specified by:
isDeepTraversing in interface Expression
Returns:
true, if the expression is deep-traversing, false otherwise.

setDeepTraversing

public void setDeepTraversing(boolean deepTraversing)
Description copied from interface: Expression
Defines, whether the expression is deep-traversing.

Specified by:
setDeepTraversing in interface Expression
Parameters:
deepTraversing - true, if the expression is deep-traversing, false otherwise.

isPreserve

public boolean isPreserve()
Description copied from interface: Expression
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.

Specified by:
isPreserve in interface Expression
Returns:
true, if the expression's results should be preserved, false otherwise.

setPreserve

public void setPreserve(boolean preserve)
Description copied from interface: Expression
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.

Specified by:
setPreserve in interface Expression
Parameters:
preserve - true, if the expression's results should be preserved, false otherwise.