/** * Creates a map from column id to value according to the aggregation columns. * * @param row The table row. * @param table The table. * @return A map from column id to value according to the aggregation columns. */ private Map<String, Value> getValuesToAggregate(TableRow row, DataTable table) { Map<String, Value> result = Maps.newHashMap(); // The map is generated by looking for the values of the aggregation columns // in the table row. for (String columnId : aggregateColumns) { Value curValue = row.getCell(table.getColumnIndex(columnId)).getValue(); result.put(columnId, curValue); } return result; }
/** * Creates a path for the aggregation tree defined by a table row. * * @param row The table row. * @param table The table. * @param depth The depth of the desired path. * @return A path for the aggregation tree defined by the table row. */ public AggregationPath getRowPath(TableRow row, DataTable table, int depth) { AggregationPath result = new AggregationPath(); // The tree path is generated by looking for the values of the group-by // columns in the table row (in the correct order). for (int i = 0; i <= depth; i++) { String columnId = groupByColumns.get(i); Value curValue = row.getCell(table.getColumnIndex(columnId)).getValue(); result.add(curValue); } return result; }