Class FormulaFunction
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.function.AbstractExpression
-
- org.pentaho.reporting.engine.classic.core.function.AbstractFunction
-
- org.pentaho.reporting.engine.classic.core.function.FormulaFunction
-
- All Implemented Interfaces:
Serializable
,Cloneable
,EventListener
,ReportListener
,Expression
,Function
public final class FormulaFunction extends AbstractFunction
The formula function is a stateful version of the FormulaExpression and is used to evaluate a LibFormula/OpenFormula expression. This function can be used if a stateful evaluation is needed or if the formula value should be initialized to a certain value before the real evaluation starts.- Author:
- Thomas Morgner
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FormulaFunction()
Default Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
clone()
Clones the expression, expression should be reinitialized after the cloning.Boolean
getFailOnError()
String
getFormula()
Returns the formula (incuding the optional namespace) as defined by the OpenFormula standard.String
getFormulaExpression()
Returns the formula expression.String
getFormulaNamespace()
Returns the formula namespace.String
getInitial()
Returns the initial formula (incuding the optional namespace) as defined by the OpenFormula standard.String
getInitialExpression()
Returns the initial formula expression.String
getInitialNamespace()
Returns the formula namespace if the initial formula.Expression
getInstance()
Return a completly separated copy of this function.Object
getValue()
Return the computed value of the formula.void
reportInitialized(ReportEvent event)
Resets the function state.void
setFailOnError(Boolean failOnError)
void
setFormula(String formula)
Defines the formula (incuding the optional namespace) as defined by the OpenFormula standard.void
setInitial(String initial)
Defines the initial formula (incuding the optional namespace) as defined by the OpenFormula standard.-
Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractFunction
groupFinished, groupStarted, itemsAdvanced, itemsFinished, itemsStarted, reportDone, reportFinished, reportStarted, summaryRowSelection
-
Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractExpression
getDataRow, getDependencyLevel, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isDeepTraversing, isPreserve, setActive, setDependencyLevel, setName, setPreserve, setRuntime
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pentaho.reporting.engine.classic.core.function.Expression
getDataRow, getDependencyLevel, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isDeepTraversing, isPreserve, setDependencyLevel, setName, setRuntime
-
-
-
-
Method Detail
-
getFailOnError
public Boolean getFailOnError()
-
setFailOnError
public void setFailOnError(Boolean failOnError)
-
getInitial
public String getInitial()
Returns the initial formula (incuding the optional namespace) as defined by the OpenFormula standard.- Returns:
- the formula as text.
-
getInitialExpression
public String getInitialExpression()
Returns the initial formula expression. The initial formula is used at the first call only.- Returns:
- the initial formula expression.
-
getInitialNamespace
public String getInitialNamespace()
Returns the formula namespace if the initial formula. If the formula specified by the user starts with "=", then the namespace "report" is assumed.- Returns:
- the namespace of the formula.
-
setInitial
public void setInitial(String initial)
Defines the initial formula (incuding the optional namespace) as defined by the OpenFormula standard. The initial formula is used at the first call only.- Parameters:
initial
- the initial formula as text.
-
reportInitialized
public void reportInitialized(ReportEvent event)
Resets the function state.- Specified by:
reportInitialized
in interfaceReportListener
- Overrides:
reportInitialized
in classAbstractFunction
- Parameters:
event
- the report event.
-
getFormula
public String getFormula()
Returns the formula (incuding the optional namespace) as defined by the OpenFormula standard.- Returns:
- the formula as text.
-
getFormulaNamespace
public String getFormulaNamespace()
Returns the formula namespace. If the formula specified by the user starts with "=", then the namespace "report" is assumed.- Returns:
- the namespace of the formula.
-
getFormulaExpression
public String getFormulaExpression()
Returns the formula expression.- Returns:
- the formula expression.
-
setFormula
public void setFormula(String formula)
Defines the formula (incuding the optional namespace) as defined by the OpenFormula standard.- Parameters:
formula
- the formula as text.
-
getValue
public Object getValue()
Return the computed value of the formula. The first call will return the initial-value instead.- Returns:
- the value of the function.
-
clone
public Object clone() throws 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 interfaceExpression
- Overrides:
clone
in classAbstractExpression
- Returns:
- A clone of this expression.
- Throws:
CloneNotSupportedException
- this should never happen.
-
getInstance
public Expression getInstance()
Return a completly separated copy of this function. The copy does no longer share any changeable objects with the original function.- Specified by:
getInstance
in interfaceExpression
- Overrides:
getInstance
in classAbstractExpression
- Returns:
- a copy of this function.
-
-