Class BucketingService
java.lang.Object
net.sf.jasperreports.crosstabs.fill.calculation.BucketingService
- Direct Known Subclasses:
CrosstabBucketingService,MultiAxisDataService.MultiAxisBucketingService
Bidimensional bucketing engine.
- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classclassprotected classprotected static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final BucketDefinition[]protected final intprotected final BucketDefinition[][]protected final BucketingService.BucketMapprotected final intprotected final BucketingService.BucketMapprotected longprotected static final byteprotected static final byteprotected static final intstatic final Stringstatic final Stringprotected final int[]protected final MeasureDefinition[]protected final intprotected booleanstatic final Stringprotected final boolean[][]protected final intprotected int[]protected intprotected intprotected boolean[]protected final BucketingServiceContextprotected final booleanprotected final MeasureDefinition.MeasureValue[]protected final MeasureDefinition.MeasureValue[] -
Constructor Summary
ConstructorsConstructorDescriptionBucketingService(BucketingServiceContext serviceContext, List<BucketDefinition> rowBuckets, List<BucketDefinition> columnBuckets, List<MeasureDefinition> measures, boolean sorted, boolean[][] retrieveTotal) Creates a crosstab bucketing engine. -
Method Summary
Modifier and TypeMethodDescriptionvoidFeeds data to the engine.protected voidaddMeasure(MeasureDefinition measure, int index, List<MeasureDefinition> measuresList, List<Integer> measureIndexList) protected voidprotected voidcheckBucketMeasureCount(int bucketMeasureCount) protected voidvoidclear()Clears all the accumulated and computed data.protected voidcomputeColumnTotal(BucketingService.BucketMap bucketMap) protected voidcomputeRowTotals(BucketingService.BucketMap bucketMap) protected voidcomputeTotals(BucketingService.BucketMap bucketMap) protected BucketingService.BucketMapcreateBucketMap(int level) protected BucketingService.BucketMapMapcreateBucketMapMap(int level) protected BucketingService.BucketMapMapprotected BucketDefinition.Bucket[]getBucketValues(Object[] bucketValues) Returns the grand total measure values.getMeasureValues(BucketDefinition.Bucket[] bucketValues) Returns the measure values for a set of bucket values.booleanhasData()Checks whether there is any data accumulated by the engine.protected MeasureDefinition.MeasureValue[]protected MeasureDefinition.MeasureValue[]voidProcesses the data which was fed to the engine.protected voidsumVals(MeasureDefinition.MeasureValue[] totals, MeasureDefinition.MeasureValue[] vals)
-
Field Details
-
EXCEPTION_MESSAGE_KEY_BUCKET_MEASURE_LIMIT
- See Also:
-
EXCEPTION_MESSAGE_KEY_BUCKET_DATA_PROCESSED
- See Also:
-
PROPERTY_BUCKET_MEASURE_LIMIT
- See Also:
-
DIMENSION_ROW
protected static final byte DIMENSION_ROW- See Also:
-
DIMENSION_COLUMN
protected static final byte DIMENSION_COLUMN- See Also:
-
DIMENSIONS
protected static final int DIMENSIONS- See Also:
-
serviceContext
-
allBuckets
-
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
-
origMeasureCount
protected final int origMeasureCount -
measureIndexes
protected final int[] measureIndexes -
sorted
protected final boolean sorted -
bucketValueMap
-
columnBucketMap
-
dataCount
protected long dataCount -
processed
protected boolean processed -
zeroMeasureValues
-
zeroUserMeasureValues
-
bucketMeasureLimit
protected final int bucketMeasureLimit
-
-
Constructor Details
-
BucketingService
public BucketingService(BucketingServiceContext serviceContext, List<BucketDefinition> rowBuckets, List<BucketDefinition> columnBuckets, List<MeasureDefinition> measures, boolean sorted, boolean[][] retrieveTotal) Creates a crosstab bucketing engine.- Parameters:
serviceContext- the bucketing service contextrowBuckets- the row bucket definitionscolumnBuckets- the column bucket definitionsmeasures- the measure definitionssorted- whether the data is presortedretrieveTotal- totals to retrieve along with the cell values
-
-
Method Details
-
checkTotals
protected void checkTotals() -
clear
public void clear()Clears all the accumulated and computed data. -
createBucketMap
-
createBucketMapMap
-
createRowTotalsBucketMap
-
addMeasure
protected void addMeasure(MeasureDefinition measure, int index, List<MeasureDefinition> measuresList, List<Integer> measureIndexList) -
addData
Feeds data to the engine.- Parameters:
bucketValues- the bucket valuesmeasureValues- the measure values- Throws:
JRException
-
bucketMeasuresCreated
protected void bucketMeasuresCreated() -
getBucketValues
-
initMeasureValues
-
initUserMeasureValues
-
processData
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:
trueif and only if the engine has any accumulated data
-
getMeasureValues
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
-
getGrandTotals
Returns the grand total measure values.- Returns:
- the grand total measure values
-
computeTotals
- Throws:
JRException
-
sumVals
protected void sumVals(MeasureDefinition.MeasureValue[] totals, MeasureDefinition.MeasureValue[] vals) throws JRException - Throws:
JRException
-
computeColumnTotal
- Throws:
JRException
-
computeRowTotals
- Throws:
JRException
-
checkBucketMeasureCount
protected void checkBucketMeasureCount(int bucketMeasureCount) -
getRowBuckets
-