net.sf.jasperreports.crosstabs.fill.calculation

## Class BucketingService

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

- Direct Known Subclasses:
    CrosstabBucketingService, MultiAxisDataService.MultiAxisBucketingService

      public abstract class BucketingService
      extends java.lang.Object

  Bidimensional bucketing engine.
  Version:
    $Id: BucketingService.java 6474 2013-09-03 14:04:04Z lucianc $
  Author:
    Lucian Chirita (lucianc@users.sourceforge.net)

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `BucketingService.BucketListMap`
    `class` | `BucketingService.BucketMap`
    `protected class` | `BucketingService.BucketMapMap`
    `protected static class` | `BucketingService.MapEntry`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected BucketDefinition[]` | `allBuckets`
    `protected BucketDefinition[][]` | `buckets`
    `protected BucketingService.BucketMap` | `bucketValueMap`
    `protected int` | `colBucketCount`
    `protected BucketingService.BucketMap` | `columnBucketMap`
    `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 int[]` | `rowRetrColMax`
    `protected int` | `rowRetrTotalMax`
    `protected int` | `rowRetrTotalMin`
    `protected boolean[]` | `rowRetrTotals`
    `protected BucketingServiceContext` | `serviceContext`
    `protected boolean` | `sorted`
    `protected MeasureDefinition.MeasureValue[]` | `zeroMeasureValues`
    `protected MeasureDefinition.MeasureValue[]` | `zeroUserMeasureValues`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BucketingService(BucketingServiceContext serviceContext, java.util.List<BucketDefinition> rowBuckets, java.util.List<BucketDefinition> columnBuckets, java.util.List<MeasureDefinition> measures, boolean sorted, boolean[][] retrieveTotal)` Creates a crosstab bucketing engine.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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<MeasureDefinition> measuresList, java.util.List<java.lang.Integer> measureIndexList)`
    `protected void` | `bucketMeasuresCreated()`
    `protected void` | `checkBucketMeasureCount(int bucketMeasureCount)`
    `protected void` | `checkTotals()`
    `void` | `clear()` Clears all the accumulated and computed data.
    `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.BucketMapMap` | `createBucketMapMap(int level)`
    `protected BucketingService.BucketMapMap` | `createRowTotalsBucketMap()`
    `protected BucketDefinition.Bucket[]` | `getBucketValues(java.lang.Object[] bucketValues)`
    `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.
    `BucketDefinition[]` | `getRowBuckets()`
    `MeasureDefinition.MeasureValue[]` | `getUserMeasureValues(MeasureDefinition.MeasureValue[] values)`
    `MeasureDefinition.MeasureValue[]` | `getZeroUserMeasureValues()`
    `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 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

    - #### serviceContext

          protected final BucketingServiceContext serviceContext

    - #### 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

    - #### rowRetrTotals

          protected boolean[] rowRetrTotals

    - #### rowRetrTotalMin

          protected int rowRetrTotalMin

    - #### rowRetrTotalMax

          protected int rowRetrTotalMax

    - #### rowRetrColMax

          protected int[] rowRetrColMax

    - #### 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

    - #### columnBucketMap

          protected final BucketingService.BucketMap columnBucketMap

    - #### dataCount

          protected long dataCount

    - #### processed

          protected boolean processed

    - #### zeroMeasureValues

          protected final MeasureDefinition.MeasureValue[] zeroMeasureValues

    - #### zeroUserMeasureValues

          protected final MeasureDefinition.MeasureValue[] zeroUserMeasureValues

  - ### Constructor Detail

    - #### BucketingService

          public BucketingService(BucketingServiceContext serviceContext,
                          java.util.List<BucketDefinition> rowBuckets,
                          java.util.List<BucketDefinition> columnBuckets,
                          java.util.List<MeasureDefinition> measures,
                          boolean sorted,
                          boolean[][] retrieveTotal)

      Creates a crosstab bucketing engine.
      Parameters:
        `serviceContext` -
        `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)

    - #### createBucketMapMap

          protected BucketingService.BucketMapMap createBucketMapMap(int level)

    - #### createRowTotalsBucketMap

          protected BucketingService.BucketMapMap createRowTotalsBucketMap()

    - #### addMeasure

          protected void addMeasure(MeasureDefinition measure,
                        int index,
                        java.util.List<MeasureDefinition> measuresList,
                        java.util.List<java.lang.Integer> 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

    - #### 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

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

    - #### getZeroUserMeasureValues

          public MeasureDefinition.MeasureValue[] getZeroUserMeasureValues()

    - #### 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`

    - #### checkBucketMeasureCount

          protected void checkBucketMeasureCount(int bucketMeasureCount)

    - #### getRowBuckets

          public BucketDefinition[] getRowBuckets()

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com