Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

jbreport.data
Class Aggregate  view Aggregate download Aggregate.java

java.lang.Object
  extended byjbreport.core.AbstractReportElement
      extended byjbreport.data.Aggregate
All Implemented Interfaces:
java.lang.Cloneable, jbreport.ReportElement, jbreport.core.Traversable, jbreport.core.XMLAware

public class Aggregate
extends jbreport.core.AbstractReportElement

This performs operations on groups of data in the report, all of which are strongly typed. It provides an extensible interface whereby operations can be defined for Aggregates to perform.

Version:
$Revision: 1.1.1.1 $

Nested Class Summary
static interface Aggregate.Aggregatable
          This is the interface that actually does all the work during data expansion.
 
Field Summary
private static int AGG_BD
          BigDecimal data type
private static int AGG_INT
          int data type
private  Aggregate.Aggregatable aggregatable
          The aggregatable instance that will be used
private  int aggType
          The data type that will be used for aggregation
private static java.util.Map aggTypes
          The currently known Aggregatable types
static java.math.BigDecimal BD_ZERO
          A constant representing the BigDecimal ZERO to two dp
private  java.lang.String opName
          The aggregate operation name
 
Fields inherited from class jbreport.core.AbstractReportElement
attrType, cdata, className, elementType, name
 
Fields inherited from interface jbreport.ReportElement
DEEP, SHALLOW
 
Constructor Summary
Aggregate()
           
 
Method Summary
 void accept(jbreport.core.ReportVisitor visitor, jbreport.core.ReportVisitorState state)
          This defines the operation that the Traversable instance must perform at each node in the traversal.
static void addAggregatable(Aggregate.Aggregatable agg)
          This method will add the given Aggregatable type to the ones currently available.
 jbreport.ReportElement copy()
          This is the same as calling copy(SHALLOW);
 jbreport.ReportElement copy(boolean deep)
          This will copy (clone) the current element, returning the copied element.
private  Aggregate.Aggregatable fetchAggregatable(java.lang.String opName)
          This will fetch an Aggregatable instance for the given operation type.
private  java.lang.String fetchColumnName()
          Returns the name of the column to which this is bound.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 void updateData(QueryResult queryResult)
          This is called for every successful next() method call on the QueryResult contained by a group.
 void xmlInitialize(java.lang.String localName, org.xml.sax.Attributes attributes)
          This should initialize the instance with data obtained during the traversal of an xml tree.
 
Methods inherited from class jbreport.core.AbstractReportElement
assert, assertNotNull, boundParameters, breakEventNotify, clone, getBoundParamValue, getElement, getFactory, getList, getName, getParent, getRepository, getString, getStylesheet, getType, inOrderIterator, inOrderTraverse, loadData, postOrderIterator, postOrderTraverse, preLoadData, preOrderIterator, preOrderTraverse, setParent, setString, xmlEnd, xmlEndChild
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BD_ZERO

public static final java.math.BigDecimal BD_ZERO
A constant representing the BigDecimal ZERO to two dp


aggTypes

private static java.util.Map aggTypes
The currently known Aggregatable types


AGG_INT

private static final int AGG_INT
int data type

See Also:
Constant Field Values

AGG_BD

private static final int AGG_BD
BigDecimal data type

See Also:
Constant Field Values

aggType

private int aggType
The data type that will be used for aggregation


opName

private java.lang.String opName
The aggregate operation name


aggregatable

private Aggregate.Aggregatable aggregatable
The aggregatable instance that will be used

Constructor Detail

Aggregate

public Aggregate()
Method Detail

addAggregatable

public static void addAggregatable(Aggregate.Aggregatable agg)
This method will add the given Aggregatable type to the ones currently available.

This method accepts an Aggregatable instance, as the operation type is obtained from the appropriate method.


accept

public void accept(jbreport.core.ReportVisitor visitor,
                   jbreport.core.ReportVisitorState state)
            throws jbreport.ReportException
Description copied from interface: jbreport.core.Traversable
This defines the operation that the Traversable instance must perform at each node in the traversal. It should be coded such that it calls an appropriate method on the ReportVisitor instance. Should an appropriate method not exist, one should be coded.

The accept method should not recurse into its children, it is the contract of the iterator to perform that function.

eg:- For node type Section the method on this node should be as follows.

   public void accept(ReportVisitor visitor, ReportVisitorState state) 
      throws ReportException {
      visitor.visitSection(this, state);
   }


copy

public jbreport.ReportElement copy()
Description copied from interface: jbreport.ReportElement
This is the same as calling copy(SHALLOW);


copy

public jbreport.ReportElement copy(boolean deep)
Description copied from interface: jbreport.ReportElement
This will copy (clone) the current element, returning the copied element.

Should the deep parameter be set, the children of this element are cloned as well, otherwise, the references are copied. This is not strictly true, as there might be classes of elements where a clone does not make sense.


updateData

public void updateData(QueryResult queryResult)
                throws jbreport.ReportException
Description copied from class: jbreport.core.AbstractReportElement
This is called for every successful next() method call on the QueryResult contained by a group.


xmlInitialize

public void xmlInitialize(java.lang.String localName,
                          org.xml.sax.Attributes attributes)
                   throws jbreport.ReportException
Description copied from interface: jbreport.ReportElement
This should initialize the instance with data obtained during the traversal of an xml tree. The child-parent relationship is catered for with the xmlEndChild() method.


fetchAggregatable

private Aggregate.Aggregatable fetchAggregatable(java.lang.String opName)
This will fetch an Aggregatable instance for the given operation type. Although the implementation would suggest that a create semantic is needed, this might change to being a factory create/find semantic.


fetchColumnName

private java.lang.String fetchColumnName()
                                  throws jbreport.ReportException
Returns the name of the column to which this is bound. This would break if we put aggregates outside a table.


toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).