JIDE 3.5.15

com.jidesoft.pivot
Interface SummaryCalculator

All Known Implementing Classes:
BigDecimalSummaryCalculator, DefaultSummaryCalculator

public interface SummaryCalculator

An interface used to calculate the summary for pivot table.

The SummaryCalculator works like this. Basically clear() will be called first so that you can clear all saved information. Then addValue will be called for each object that we will calculate the statistics, you will collect them into a List or something like that. Then getSummaryResult(int summaryType) will be called which will return the statistics of all the values in the List that you saved so far until clear is called again to clear the List.


Field Summary
static int[] ALLOWED_SUMMARIES_ALL
           
static int[] ALLOWED_SUMMARIES_COUNT
           
static int[] ALLOWED_SUMMARIES_MAX_MIN_COUNT
           
 
Method Summary
 void addValue(IPivotDataModel dataModel, PivotField field, int rowIndex, int columnIndex, Object value)
          Deprecated. replaced by addValue(PivotValueProvider, PivotField, Values, Values, Object)
 void addValue(Object value)
          Adds a value for calculation.
 void addValue(PivotValueProvider valueProvider, PivotField field, Object value)
          Deprecated. replaced by addValue(PivotValueProvider, PivotField, Values, Values, Object)
 void addValue(PivotValueProvider dataModel, PivotField field, Values rowValues, Values columnValues, Object value)
          Adds a value for calculation.
 void clear()
          Clears all previous added values.
 int[] getAllowedSummaries(Class<?> type)
          Gets the allowed summary types for a data type.
 int[] getAllowedSummaries(Class<?> type, ConverterContext context)
          Gets the allowed summary types for a data type.
 long getCount()
          Gets the number of values that have been added so far.
 int getNumberOfSummaries()
          Gets the number of summary types.
 String getSummaryName(Locale locale, int type)
          Gets the summary name for the specified type.
 Object getSummaryResult(int type)
          Gets the summary result for the specified type.
 

Field Detail

ALLOWED_SUMMARIES_ALL

static final int[] ALLOWED_SUMMARIES_ALL

ALLOWED_SUMMARIES_MAX_MIN_COUNT

static final int[] ALLOWED_SUMMARIES_MAX_MIN_COUNT

ALLOWED_SUMMARIES_COUNT

static final int[] ALLOWED_SUMMARIES_COUNT
Method Detail

addValue

void addValue(Object value)
Adds a value for calculation.

Parameters:
value - the value

addValue

void addValue(PivotValueProvider dataModel,
              PivotField field,
              Values rowValues,
              Values columnValues,
              Object value)
Adds a value for calculation. Different from addValue(Object) which only takes the value as parameter, this method provides PivotValueProvider, PivotField and row/column values of the cell as in the DataTableModel.

To get the row indices in the original table model, please try to use the following code.

 ((IPivotDataModel) dataModel).getDataAt(((DefaultValues) rowValues).toCompoundKey(), ((DefaultValues) columnValues).toCompoundKey());
 

Parameters:
dataModel - the PivotDataModel
field - the PivotField
rowValues - the row values corresponding to the cell to calculate.
columnValues - the column values corresponding to the cell to calculate.
value - the value

addValue

@Deprecated
void addValue(IPivotDataModel dataModel,
                         PivotField field,
                         int rowIndex,
                         int columnIndex,
                         Object value)
Deprecated. replaced by addValue(PivotValueProvider, PivotField, Values, Values, Object)

Adds a value for calculation. Different from addValue(Object) which only takes the value as parameter, this method provides PivotDataModel, PivotField and row/column index of the cell as in the DataTableModel.

Parameters:
dataModel - the PivotDataModel
field - the PivotField
rowIndex - the row index as in the PivotDataModel#getDataTableModel. It could be -1 if the row index is not available.
columnIndex - the column index as in the PivotDataModel#getDataTableModel. It could be -1 if the column index is not available.
value - the value

addValue

@Deprecated
void addValue(PivotValueProvider valueProvider,
                         PivotField field,
                         Object value)
Deprecated. replaced by addValue(PivotValueProvider, PivotField, Values, Values, Object)

Adds a value for calculation..

Parameters:
valueProvider - the PivotValueProvider
field - the PivotField
value - the value

clear

void clear()
Clears all previous added values.


getCount

long getCount()
Gets the number of values that have been added so far.

Returns:
the number of values that have been added so far.

getNumberOfSummaries

int getNumberOfSummaries()
Gets the number of summary types.

Returns:
the number of statistic types.

getSummaryName

String getSummaryName(Locale locale,
                      int type)
Gets the summary name for the specified type.

Parameters:
locale - the current locale
type -
Returns:
the summary name.

getSummaryResult

Object getSummaryResult(int type)
Gets the summary result for the specified type.

Parameters:
type -
Returns:
the summary result for the specified type.

getAllowedSummaries

int[] getAllowedSummaries(Class<?> type)
Gets the allowed summary types for a data type.

Parameters:
type - the data type.
Returns:
the allowed summary types.

getAllowedSummaries

int[] getAllowedSummaries(Class<?> type,
                          ConverterContext context)
Gets the allowed summary types for a data type.

Parameters:
type - the data type.
context - the converter context. If the type is the same and you want it to have different summary types, you can use the converter context to make them different.
Returns:
the allowed summary types.

JIDE 3.5.15