Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.jasperreports.crosstabs.fill.calculation
Class BucketingService

    java.lang.Object
      net.sf.jasperreports.crosstabs.fill.calculation.BucketingService

    public class BucketingService

extends java.lang.Object

Crosstab bucketing engine.

Version:
  $Id: BucketingService.java 3940 2010-08-20 10:35:15Z teodord $
Author:
  Lucian Chirita (lucianc@users.sourceforge.net)

Nested Class Summary
`protected class` | `BucketingService.BucketListMap`
`protected class` | `BucketingService.BucketMap`
`protected class` | `BucketingService.BucketTreeMap`
`protected static class` | `BucketingService.CollectedList`
`protected static class` | `BucketingService.CollectedListComparator`
`protected static class` | `BucketingService.MapEntry`
`protected static class` | `BucketingService.OrderedCollectedList`
`protected static class` | `BucketingService.SequentialCollectedList`

Field Summary
`protected BucketDefinition[]` | `allBuckets`
`protected BucketDefinition[][]` | `buckets`
`protected BucketingService.BucketMap` | `bucketValueMap`
`protected CrosstabCell[][]` | `cells`
`protected int` | `colBucketCount`
`protected HeaderCell[][]` | `colHeaders`
`protected long` | `dataCount`
`protected static byte` | `DIMENSION_COLUMN`
`protected static byte` | `DIMENSION_ROW`
`protected static int` | `DIMENSIONS`
`protected int[]` | `measureIndexes`
`protected MeasureDefinition[]` | `measures`
`protected int` | `origMeasureCount`
`protected boolean` | `processed`
`static java.lang.String` | `PROPERTY_BUCKET_MEASURE_LIMIT`
`protected boolean[][]` | `retrieveTotal`
`protected int` | `rowBucketCount`
`protected HeaderCell[][]` | `rowHeaders`
`protected boolean` | `sorted`

Constructor Summary
`BucketingService(JRFillCrosstab fillCrosstab, java.util.List rowBuckets, java.util.List columnBuckets, java.util.List measures, boolean sorted, boolean[][] retrieveTotal)` Creates a crosstab bucketing engine.

Method Summary
`void` | `addData(java.lang.Object[] bucketValues, java.lang.Object[] measureValues)` Feeds data to the engine.
`protected void` | `addMeasure(MeasureDefinition measure, int index, java.util.List measuresList, java.util.List measureIndexList)`
`protected void` | `bucketMeasuresCreated()`
`protected void` | `checkBucketMeasureCount(int bucketMeasureCount)`
`protected void` | `checkTotals()`
`void` | `clear()` Clears all the accumulated and computed data.
`protected void` | `collectCols(BucketingService.BucketListMap collectedCols, BucketingService.BucketMap bucketMap)`
`protected void` | `computeColumnTotal(BucketingService.BucketMap bucketMap)`
`protected void` | `computeRowTotals(BucketingService.BucketMap bucketMap)`
`protected void` | `computeTotals(BucketingService.BucketMap bucketMap)`
`protected BucketingService.BucketMap` | `createBucketMap(int level)`
`protected BucketingService.BucketListMap` | `createCollectBucketMap(int level)`
`protected void` | `createCrosstab()`
`protected HeaderCell[][]` | `createHeaders(byte dimension, BucketingService.CollectedList[] headersLists)`
`protected BucketingService.CollectedList` | `createHeadersList(byte dimension, BucketingService.BucketMap bucketMap, int level, boolean total)`
`protected java.lang.Object` | `evaluateOrderValue(BucketingService.BucketMap bucketMap, BucketDefinition.Bucket bucket)`
`protected void` | `fillCell(int[] pos, java.util.List vals, java.util.List bucketMaps, MeasureDefinition.MeasureValue[] values)`
`protected void` | `fillCells(BucketingService.CollectedList[] collectedHeaders, BucketingService.BucketMap bucketMap, int level, int[] pos, java.util.List vals, java.util.List bucketMaps)`
`protected void` | `fillHeaders(byte dimension, HeaderCell[][] headers, int level, int col, BucketingService.CollectedList list, java.util.List vals)`
`protected BucketDefinition.Bucket[]` | `getBucketValues(java.lang.Object[] bucketValues)`
`HeaderCell[][]` | `getColumnHeaders()` Returns the crosstab column headers.
`CrosstabCell[][]` | `getCrosstabCells()` Returns the crosstab data cells.
`MeasureDefinition.MeasureValue[]` | `getGrandTotals()` Returns the grand total measure values.
`MeasureDefinition.MeasureValue[]` | `getMeasureValues(BucketDefinition.Bucket[] bucketValues)` Returns the measure values for a set of bucket values.
`HeaderCell[][]` | `getRowHeaders()` Returns the crosstab row headers.
`protected MeasureDefinition.MeasureValue[]` | `getUserMeasureValues(MeasureDefinition.MeasureValue[] values)`
`boolean` | `hasData()` Checks whether there is any data accumulated by the engine.
`protected MeasureDefinition.MeasureValue[]` | `initMeasureValues()`
`protected MeasureDefinition.MeasureValue[]` | `initUserMeasureValues()`
`void` | `processData()` Processes the data which was fed to the engine.
`protected MeasureDefinition.MeasureValue[][][]` | `retrieveTotals(java.util.List vals, java.util.List bucketMaps)`
`protected void` | `sumVals(MeasureDefinition.MeasureValue[] totals, MeasureDefinition.MeasureValue[] vals)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### PROPERTY_BUCKET_MEASURE_LIMIT

    public static final java.lang.String PROPERTY_BUCKET_MEASURE_LIMIT

See Also:
  Constant Field Values

### DIMENSION_ROW

    protected static final byte DIMENSION_ROW

See Also:
  Constant Field Values

### DIMENSION_COLUMN

    protected static final byte DIMENSION_COLUMN

See Also:
  Constant Field Values

### DIMENSIONS

    protected static final int DIMENSIONS

See Also:
  Constant Field Values

### allBuckets

    protected final BucketDefinition[] allBuckets

### buckets

    protected final BucketDefinition[][] buckets

### rowBucketCount

    protected final int rowBucketCount

### colBucketCount

    protected final int colBucketCount

### retrieveTotal

    protected final boolean[][] retrieveTotal

### measures

    protected final MeasureDefinition[] measures

### origMeasureCount

    protected final int origMeasureCount

### measureIndexes

    protected final int[] measureIndexes

### sorted

    protected final boolean sorted

### bucketValueMap

    protected final BucketingService.BucketMap bucketValueMap

### dataCount

    protected long dataCount

### processed

    protected boolean processed

### colHeaders

    protected HeaderCell[][] colHeaders

### rowHeaders

    protected HeaderCell[][] rowHeaders

### cells

    protected CrosstabCell[][] cells

Constructor Detail

### BucketingService

    public BucketingService(JRFillCrosstab fillCrosstab,
                            java.util.List rowBuckets,
                            java.util.List columnBuckets,
                            java.util.List measures,
                            boolean sorted,
                            boolean[][] retrieveTotal)

  Creates a crosstab bucketing engine.

  Parameters:
    `fillCrosstab` -
    `rowBuckets` - the row bucket definitions
    `columnBuckets` - the column bucket definitions
    `measures` - the measure definitions
    `sorted` - whether the data is presorted
    `retrieveTotal` - totals to retrieve along with the cell values

Method Detail

### checkTotals

    protected void checkTotals()

### clear

    public void clear()

  Clears all the accumulated and computed data.

### createBucketMap

    protected BucketingService.BucketMap createBucketMap(int level)

### createCollectBucketMap

    protected BucketingService.BucketListMap createCollectBucketMap(int level)

### addMeasure

    protected void addMeasure(MeasureDefinition measure,
                              int index,
                              java.util.List measuresList,
                              java.util.List measureIndexList)

### addData

    public void addData(java.lang.Object[] bucketValues,
                        java.lang.Object[] measureValues)
                 throws JRException

  Feeds data to the engine.

  Parameters:
    `bucketValues` - the bucket values
    `measureValues` - the measure values
  Throws:
    `JRException`

### bucketMeasuresCreated

    protected void bucketMeasuresCreated()

### getBucketValues

    protected BucketDefinition.Bucket[] getBucketValues(java.lang.Object[] bucketValues)

### initMeasureValues

    protected MeasureDefinition.MeasureValue[] initMeasureValues()

### initUserMeasureValues

    protected MeasureDefinition.MeasureValue[] initUserMeasureValues()

### processData

    public void processData()
                     throws JRException

  Processes the data which was fed to the engine.

  This method should be called after the data has been exhausted. The processing consists of total calculations and crosstab table creation.

  Throws:
    `JRException`

### hasData

    public boolean hasData()

  Checks whether there is any data accumulated by the engine.

  Returns:
    `true` if and only if the engine has any accumulated data

### getColumnHeaders

    public HeaderCell[][] getColumnHeaders()

  Returns the crosstab column headers.

  `processData()` has to be called before this.

  Returns:
    the crosstab column headers

### getRowHeaders

    public HeaderCell[][] getRowHeaders()

  Returns the crosstab row headers.

  `processData()` has to be called before this.

  Returns:
    the crosstab row headers

### getCrosstabCells

    public CrosstabCell[][] getCrosstabCells()

  Returns the crosstab data cells.

  `processData()` has to be called before this.

  Returns:
    the crosstab data cells

### getMeasureValues

    public MeasureDefinition.MeasureValue[] getMeasureValues(BucketDefinition.Bucket[] bucketValues)

  Returns the measure values for a set of bucket values.

  Parameters:
    `bucketValues` - the bucket values
  Returns:
    the measure values corresponding to the bucket values

### getUserMeasureValues

    protected MeasureDefinition.MeasureValue[] getUserMeasureValues(MeasureDefinition.MeasureValue[] values)

### getGrandTotals

    public MeasureDefinition.MeasureValue[] getGrandTotals()

  Returns the grand total measure values.

  Returns:
    the grand total measure values

### computeTotals

    protected void computeTotals(BucketingService.BucketMap bucketMap)
                          throws JRException

  Throws:
    `JRException`

### sumVals

    protected void sumVals(MeasureDefinition.MeasureValue[] totals,
                           MeasureDefinition.MeasureValue[] vals)
                    throws JRException

  Throws:
    `JRException`

### computeColumnTotal

    protected void computeColumnTotal(BucketingService.BucketMap bucketMap)
                               throws JRException

  Throws:
    `JRException`

### computeRowTotals

    protected void computeRowTotals(BucketingService.BucketMap bucketMap)
                             throws JRException

  Throws:
    `JRException`

### createCrosstab

    protected void createCrosstab()
                           throws JRException

  Throws:
    `JRException`

### checkBucketMeasureCount

    protected void checkBucketMeasureCount(int bucketMeasureCount)

### collectCols

    protected void collectCols(BucketingService.BucketListMap collectedCols,
                               BucketingService.BucketMap bucketMap)
                        throws JRException

  Throws:
    `JRException`

### createHeadersList

    protected BucketingService.CollectedList createHeadersList(byte dimension,
                                                               BucketingService.BucketMap bucketMap,
                                                               int level,
                                                               boolean total)
                                                        throws JRException

  Throws:
    `JRException`

### evaluateOrderValue

    protected java.lang.Object evaluateOrderValue(BucketingService.BucketMap bucketMap,
                                                  BucketDefinition.Bucket bucket)
                                           throws JRException

  Throws:
    `JRException`

### createHeaders

    protected HeaderCell[][] createHeaders(byte dimension,
                                           BucketingService.CollectedList[] headersLists)

### fillHeaders

    protected void fillHeaders(byte dimension,
                               HeaderCell[][] headers,
                               int level,
                               int col,
                               BucketingService.CollectedList list,
                               java.util.List vals)

### fillCells

    protected void fillCells(BucketingService.CollectedList[] collectedHeaders,
                             BucketingService.BucketMap bucketMap,
                             int level,
                             int[] pos,
                             java.util.List vals,
                             java.util.List bucketMaps)

### fillCell

    protected void fillCell(int[] pos,
                            java.util.List vals,
                            java.util.List bucketMaps,
                            MeasureDefinition.MeasureValue[] values)

### retrieveTotals

    protected MeasureDefinition.MeasureValue[][][] retrieveTotals(java.util.List vals,
                                                                  java.util.List bucketMaps)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com