net.sf.jasperreports.crosstabs.fill.calculation

## Class BucketDefinition

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

- Direct Known Subclasses:
    MultiAxisDataService.PropertiesWrapperBucketDefintion

      public class BucketDefinition
      extends java.lang.Object

  Bucket definition.
  Version:
    $Id: BucketDefinition.java 6434 2013-08-28 12:55:35Z lucianc $
  Author:
    Lucian Chirita (lucianc@users.sourceforge.net)

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `BucketDefinition.Bucket` Bucket value class.
    `class` | `BucketDefinition.OrderDecoratorBucket`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.Comparator<java.lang.Object>` | `bucketValueComparator`
    `protected BucketOrderer` | `orderer`
    `protected BucketDefinition.Bucket` | `VALUE_NULL` The null bucket.
    `protected BucketDefinition.Bucket` | `VALUE_TOTAL` The total value for this bucket.
    `protected static byte` | `VALUE_TYPE_NULL` Value type used for null bucket values.
    `protected static byte` | `VALUE_TYPE_TOTAL` Value type used for total buckets.
    `protected static byte` | `VALUE_TYPE_VALUE` Value type used for non-null values.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BucketDefinition(java.lang.Class<?> valueClass, BucketOrderer orderer, java.util.Comparator<java.lang.Object> comparator, BucketOrder order, CrosstabTotalPositionEnum totalPosition)` Creates a bucket.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `computeTotal()` Whether this bucket needs total calculation.
    `BucketDefinition.Bucket` | `create(java.lang.Object value)` Creates a `BucketValue` object for a given value.
    `static java.util.Comparator<java.lang.Object>` | `createOrderComparator(java.util.Comparator<java.lang.Object> comparator, BucketOrder order)`
    `BucketOrder` | `getOrder()`
    `BucketOrderer` | `getOrderer()`
    `CrosstabTotalPositionEnum` | `getTotalPosition()` Returns the total bucket position.
    `boolean` | `isSorted()`
    `void` | `setComputeTotal()` Instructs that the bucket will need total bucket calculation.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### VALUE_TYPE_VALUE

          protected static final byte VALUE_TYPE_VALUE

      Value type used for non-null values.
      See Also:
        Constant Field Values

    - #### VALUE_TYPE_NULL

          protected static final byte VALUE_TYPE_NULL

      Value type used for null bucket values.
      See Also:
        Constant Field Values

    - #### VALUE_TYPE_TOTAL

          protected static final byte VALUE_TYPE_TOTAL

      Value type used for total buckets.
      See Also:
        Constant Field Values

    - #### VALUE_TOTAL

          protected final BucketDefinition.Bucket VALUE_TOTAL

      The total value for this bucket.

    - #### VALUE_NULL

          protected final BucketDefinition.Bucket VALUE_NULL

      The null bucket.

    - #### bucketValueComparator

          protected final java.util.Comparator<java.lang.Object> bucketValueComparator

    - #### orderer

          protected final BucketOrderer orderer

  - ### Constructor Detail

    - #### BucketDefinition

          public BucketDefinition(java.lang.Class<?> valueClass,
                          BucketOrderer orderer,
                          java.util.Comparator<java.lang.Object> comparator,
                          BucketOrder order,
                          CrosstabTotalPositionEnum totalPosition)
                           throws JRException

      Creates a bucket.
      Parameters:
        `valueClass` - the class of the bucket values
        `orderer` - bucket entries orderer
        `comparator` - the comparator to use for bucket sorting
        `order` - the order type, `BucketOrder.ASCENDING`, `BucketOrder.DESCENDING` or `BucketOrder.NONE`
        `totalPosition` - the position of the total bucket
      Throws:
        `JRException`

  - ### Method Detail

    - #### createOrderComparator

          public static java.util.Comparator<java.lang.Object> createOrderComparator(java.util.Comparator<java.lang.Object> comparator,
                                                                     BucketOrder order)

    - #### isSorted

          public boolean isSorted()

    - #### computeTotal

          public boolean computeTotal()

      Whether this bucket needs total calculation.
      Returns:
        this bucket needs total calculation

    - #### setComputeTotal

          public void setComputeTotal()

      Instructs that the bucket will need total bucket calculation.
      See Also:
        `computeTotal()`

    - #### getTotalPosition

          public CrosstabTotalPositionEnum getTotalPosition()

      Returns the total bucket position.
      Returns:
        the total bucket position

    - #### getOrderer

          public BucketOrderer getOrderer()

    - #### getOrder

          public BucketOrder getOrder()

    - #### create

          public BucketDefinition.Bucket create(java.lang.Object value)

      Creates a `BucketValue` object for a given value.
      Parameters:
        `value` - the value
      Returns:
        the corresponding `BucketValue` object

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com