org.jfree.report.function
Class CountDistinctFunction

java.lang.Object
  extended byorg.jfree.report.function.AbstractFunction
      extended byorg.jfree.report.function.CountDistinctFunction
All Implemented Interfaces:
java.lang.Cloneable, java.util.EventListener, Expression, Function, ReportListener, java.io.Serializable

public class CountDistinctFunction
extends AbstractFunction
implements java.io.Serializable

Counts the distinct occurences of an certain value of an column. This functionality is similiar to the SQL distinct() function.

Author:
Thomas Morgner
See Also:
Serialized Form

Field Summary
static java.lang.String FIELD_PROPERTY
          Literal text for the 'field' property.
static java.lang.String GROUP_PROPERTY
          Literal text for the 'group' property.
 
Fields inherited from interface org.jfree.report.function.Expression
AUTOACTIVATE_PROPERTY
 
Constructor Summary
CountDistinctFunction()
          DefaultConstructor.
 
Method Summary
 java.lang.String getField()
          Returns the field used by the function.
 java.lang.String getGroup()
          Returns the group name.
 java.lang.Object getValue()
          Return the number of distint values for the given column.
 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 report generation initializes the current run.
 void setField(java.lang.String field)
          Sets the field name for the function.
 void setGroup(java.lang.String name)
          Sets the group name.
 
Methods inherited from class org.jfree.report.function.AbstractFunction
clone, getDataRow, getDependencyLevel, getInstance, getName, getProperties, getProperty, getProperty, groupFinished, initialize, isActive, itemsFinished, itemsStarted, reportDone, reportFinished, reportStarted, setDataRow, setDependencyLevel, setName, setProperties, setProperty
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GROUP_PROPERTY

public static final java.lang.String GROUP_PROPERTY
Literal text for the 'group' property.

See Also:
Constant Field Values

FIELD_PROPERTY

public static final java.lang.String FIELD_PROPERTY
Literal text for the 'field' property.

See Also:
Constant Field Values
Constructor Detail

CountDistinctFunction

public CountDistinctFunction()
DefaultConstructor.

Method Detail

getGroup

public java.lang.String getGroup()
Returns the group name.

Returns:
The group name.

setGroup

public void setGroup(java.lang.String name)
Sets the group name.

If a group is defined, the running total is reset to zero at the start of every instance of this group.

Parameters:
name - the group name (null permitted).

getField

public java.lang.String getField()
Returns the field used by the function.

The field name corresponds to a column name in the report's TableModel.

Returns:
The field name.

setField

public void setField(java.lang.String field)
Sets the field name for the function.

The field name corresponds to a column name in the report's TableModel.

Parameters:
field - the field name (null not permitted).

reportInitialized

public void reportInitialized(ReportEvent event)
Receives notification that report generation initializes the current run.

The event carries a ReportState.Started state. Use this to initialize the report.

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.

getValue

public java.lang.Object getValue()
Return the number of distint values for the given column.

Specified by:
getValue in interface Expression
Returns:
the value of the function.