planetj.database.report
Class ReportBreak

java.lang.Object
  |
  +--planetj.database.report.ReportBreak
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
OverallReportBreak

public class ReportBreak
extends Object
implements Serializable

Defines how and where reports should be generated for a RowCollection.

A report contains the results of an operation (such as a summation or average) on one or more columns in a group of Rows. These reports are contained in ReportBreakRows (a subclass of Row) and placed in the same RowCollection as the original Row objects.

ReportBreakRow objects are always located immediately after the group of Rows which were used to generate the contained report. This group of Rows may be a subset of the Rows returned by an SQL query, and it may include Rows from more than one RowCollection (in cases where the number of Rows returned by a query exceeds the number of Rows allowed in a RowCollection). The "break" where a ReportBreakRow is inserted is specified by the BreakColumn property - whenever two adjacent Rows contain different values in that column a report is generated and a ReportBreakRow is placed between those two Rows in the RowCollection.

ReportBreaks are intended to be used in conjunction with the ORDER BY sql clause. The ORDER BY clause will sort Rows by a specific column or columns, and then reports can be generated for each group of values that was ordered.

To create a ReportBreak, use the ReportBreakCollection.addNewReportBreak() method. Once created the properties of a ReportBreak cannot be altered.

See Also:
Serialized Form

Constructor Summary
ReportBreak(ReportBreakCollection prbc, String pColumnFunctionToken, List pFieldNames, String pBreakColumnName)
          ReportBreak constructor
 
Method Summary
 boolean equals(Object o)
          Tests if this ReportBreak is equal to another ReportBreak.
 String getBreakColumn()
          Gets the name of the column which this ReportBreak will monitor for breaks.
 String getColumnFunctionToken()
          Gets the column function token representing the function that will be used to generate this ReportBreak's reports
 List getFieldNames()
          Gets the List of field names identifying the columns which will be used by this ReportBreak for generating ReportBreakRows.
 int getIndex()
          Gets the index of this ReportBreak.
 Object getLastValue()
          Gets the last value of the field which is being monitored for breaks
 OverallReportBreak getOverallReportBreak()
          If an OverallReportBreak with the same field descriptors and column function was created when this ReportBreak was created, then that OverallReportBreak is returned.
 ReportBreakCollection getReportBreakCollection()
          Gets the ReportBreakCollection which contains this ReportBreak
 List getRows()
          Gets a List of the ReportBreakRows which have been generated by this ReportBreak
 int hashCode()
          Returns a hashCode for this ReportBreak.
 boolean isOverallReportBreak()
          This is not an OverallReportBreak
 ReportBreakRow processRow(Row pRow, RowCollection pRC)
          Passes a Row into to one or more column functions, and determines if a ReportBreakRow needs to be positioned prior to that Row
 void reset()
          Clears all values from all of the column functions
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReportBreak

public ReportBreak(ReportBreakCollection prbc,
                   String pColumnFunctionToken,
                   List pFieldNames,
                   String pBreakColumnName)
            throws DataEngineException
ReportBreak constructor

Method Detail

equals

public boolean equals(Object o)
Tests if this ReportBreak is equal to another ReportBreak. Two ReportBreaks are equal if given the same RowCollection, they would produce the same report(s). The current states of their column functions are not compared

Overrides:
equals in class Object

getBreakColumn

public String getBreakColumn()
Gets the name of the column which this ReportBreak will monitor for breaks.


getColumnFunctionToken

public String getColumnFunctionToken()
Gets the column function token representing the function that will be used to generate this ReportBreak's reports


getFieldNames

public List getFieldNames()
Gets the List of field names identifying the columns which will be used by this ReportBreak for generating ReportBreakRows.


getIndex

public int getIndex()
Gets the index of this ReportBreak. When multiple ReportBreakRows are placed in a single break in a RowCollection they are ordered according to their indices. The smallest index is 0.


getLastValue

public Object getLastValue()
Gets the last value of the field which is being monitored for breaks


getOverallReportBreak

public OverallReportBreak getOverallReportBreak()
If an OverallReportBreak with the same field descriptors and column function was created when this ReportBreak was created, then that OverallReportBreak is returned. Otherwise, null is returned.


getReportBreakCollection

public ReportBreakCollection getReportBreakCollection()
Gets the ReportBreakCollection which contains this ReportBreak


getRows

public List getRows()
Gets a List of the ReportBreakRows which have been generated by this ReportBreak


hashCode

public int hashCode()
Returns a hashCode for this ReportBreak. The current state of the column functions are not taken into account in the hashCode

Overrides:
hashCode in class Object

isOverallReportBreak

public boolean isOverallReportBreak()
This is not an OverallReportBreak


processRow

public ReportBreakRow processRow(Row pRow,
                                 RowCollection pRC)
                          throws CMException
Passes a Row into to one or more column functions, and determines if a ReportBreakRow needs to be positioned prior to that Row

Parameters:
pRow - A Row that was just added to a RowCollection
Returns:
A ReportBreakRow that should be inserted into the RowCollection prior to pRow, or null if no such ReportBreakRow exists.
CMException

reset

public void reset()
Clears all values from all of the column functions