// Populate the dataset with the calculations.
// For each group by interval add a row to the data set.
Predicate nonNullElements = new Predicate() { public boolean evaluate(Object o) { return o != null; }};
Interval[] groupByIntervals = groupByProperty.getDomain().getIntervals();
for (int i=0; i<groupByIntervals.length; i++) {
Interval groupByInterval = groupByIntervals[i];
// For each data set property calculate its grouped interval value.
for (int j=0; j<groupByProps.size(); j++) {
// The row value for the group by column is the own interval instance.
DataProperty grProp = groupByDataSet.getProperties()[j];
String grFunctionCode = functionCodes.get(j);
if (grProp == pivotProp) {
groupByDataSet.addRowValue(j, groupByInterval);
}
// The value for the other columns is a scalar function applied over the column values belonging to the interval.
else {
DataProperty dataSetProp = getPropertyById(grProp.getPropertyId());
Collection dataSetValues = groupByInterval.getValues(dataSetProp);
if (!CollectionUtils.exists(dataSetValues, nonNullElements)) {
// If all the interval elements to group are null then set 0.
groupByDataSet.addRowValue(j, new Double(0));
} else {
ScalarFunctionManager scalarFunctionManager = DataProviderServices.lookup().getScalarFunctionManager();