return result;
}
private DataSet _buildDataSet(InternalContext context) {
DataSetOp lastOp = context.lastOperation;
DataSetIndexNode index = context.index;
DataSet dataSet = context.dataSet;
if (lastOp instanceof DataSetGroup) {
DataSetGroup gOp = (DataSetGroup) lastOp;
ColumnGroup columnGroup = gOp.getColumnGroup();
if (columnGroup == null) {
return _buildDataSet(context, gOp.getGroupFunctions());
} else {
if (!gOp.getSelectedIntervalNames().isEmpty() && gOp.getGroupFunctions().isEmpty()) {
return dataSet.trim(index.getRows());
} else {
return _buildDataSet(context, gOp);
}
}
}
if (lastOp instanceof DataSetFilter) {
return dataSet.trim(index.getRows());
}
if (lastOp instanceof DataSetSort) {
DataSetImpl sortedDataSet = new DataSetImpl();
for (DataColumn column : dataSet.getColumns()) {
SortedList sortedValues = new SortedList(column.getValues(), index.getRows());
sortedDataSet.addColumn(column.getId(), column.getColumnType(), sortedValues);
}
return sortedDataSet;
}
return dataSet;