org.pentaho.reporting.engine.classic.core.function
Class TotalItemMaxFunction

java.lang.Object
  extended by org.pentaho.reporting.engine.classic.core.function.AbstractExpression
      extended by org.pentaho.reporting.engine.classic.core.function.AbstractFunction
          extended by org.pentaho.reporting.engine.classic.core.function.TotalItemMaxFunction
All Implemented Interfaces:
Serializable, Cloneable, EventListener, ReportListener, AggregationFunction, Expression, FieldAggregationFunction, Function

public class TotalItemMaxFunction
extends AbstractFunction
implements FieldAggregationFunction

A report function that pre-computes the largest item in a group. The Items must be mutually comparable among each other or the function will fail. Comparing dates with strings will not work.

Like all Total-Functions, this function produces a precomputed grand total. The function's result is precomputed once and will not change later. Printing the result of this function in a group header returns the same value as printed in the group-footer.

A group can be defined using the property "group". If the group property is not set, the function will process the whole report.

Author:
Thomas Morgner
See Also:
Serialized Form

Constructor Summary
TotalItemMaxFunction()
          Default constructor.
 
Method Summary
 String getField()
          Returns the field used by the function.
 String getGroup()
          Returns the name of the group for which the minimum should be computed.
 Expression getInstance()
          Return a completly separated copy of this function.
 Object getValue()
          Returns the computed maximum value.
 void groupStarted(ReportEvent event)
          Receives notification that a group has started.
 void itemsAdvanced(ReportEvent event)
          Receives notification that a row of data is being processed.
 void reportInitialized(ReportEvent event)
          Receives notification that the report has started.
 void setField(String field)
          Sets the field name for the function.
 void setGroup(String group)
          Defines the name of the group to be totalled.
 
Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractFunction
groupFinished, itemsFinished, itemsStarted, reportDone, reportFinished, reportStarted
 
Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractExpression
clone, getDataRow, getDependencyLevel, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isDeepTraversing, isPreserve, setActive, setDependencyLevel, setName, setPreserve, setRuntime
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.pentaho.reporting.engine.classic.core.event.ReportListener
groupFinished, itemsFinished, itemsStarted, reportDone, reportFinished, reportStarted
 
Methods inherited from interface org.pentaho.reporting.engine.classic.core.function.Expression
clone, getDataRow, getDependencyLevel, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isDeepTraversing, isPreserve, setDependencyLevel, setName, setRuntime
 

Constructor Detail

TotalItemMaxFunction

public TotalItemMaxFunction()
Default constructor.

Method Detail

getField

public String getField()
Returns the field used by the function. The field name corresponds to a column name in the report's data-row.

Specified by:
getField in interface FieldAggregationFunction
Returns:
The field name.

setField

public void setField(String field)
Sets the field name for the function. The field name corresponds to a column name in the report's data-row.

Specified by:
setField in interface FieldAggregationFunction
Parameters:
field - the field name.

reportInitialized

public void reportInitialized(ReportEvent event)
Receives notification that the report has started.

Specified by:
reportInitialized in interface ReportListener
Overrides:
reportInitialized in class AbstractFunction
Parameters:
event - the event.

groupStarted

public void groupStarted(ReportEvent event)
Receives notification that a group has started.

Specified by:
groupStarted in interface ReportListener
Overrides:
groupStarted in class AbstractFunction
Parameters:
event - the event.

itemsAdvanced

public void itemsAdvanced(ReportEvent event)
Receives notification that a row of data is being processed.

Specified by:
itemsAdvanced in interface ReportListener
Overrides:
itemsAdvanced in class AbstractFunction
Parameters:
event - the event.

getGroup

public String getGroup()
Returns the name of the group for which the minimum should be computed.

Specified by:
getGroup in interface AggregationFunction
Returns:
the group name.

setGroup

public void setGroup(String group)
Defines the name of the group to be totalled. If the name is null, the minimum for the whole report is computed.

Specified by:
setGroup in interface AggregationFunction
Parameters:
group - the group name.

getValue

public Object getValue()
Returns the computed maximum value.

Specified by:
getValue in interface Expression
Returns:
The computed maximum value.

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 interface Expression
Overrides:
getInstance in class AbstractExpression
Returns:
a copy of this function.