use of mondrian.olap.Position in project mondrian by pentaho.
the class RolapResult method populateEvaluator.
void populateEvaluator(Evaluator evaluator, int[] pos) {
for (int i = -1; i < axes.length; i++) {
Axis axis;
int index;
if (i < 0) {
axis = slicerAxis;
if (axis.getPositions().isEmpty()) {
continue;
}
index = 0;
} else {
axis = axes[i];
index = pos[i];
}
Position position = axis.getPositions().get(index);
evaluator.setContext(position);
}
}
use of mondrian.olap.Position in project pentaho-kettle by pentaho.
the class MondrianHelper method outputFlattenedRecurse.
private static void outputFlattenedRecurse(Result result, List<List<Object>> rows, List<Object> rowValues, int[] coords, int axisOrdinal) {
final Axis[] axes = result.getAxes();
if (axisOrdinal == axes.length) {
final Cell cell = result.getCell(coords);
// Output the raw (unformatted) value of the cell.
// NOTE: We could output other properties of the cell here, such as its
// formatted value, too.
rowValues.add(cell.getValue());
// Add a copy of the completed row to the list of rows.
rows.add(new ArrayList<>(rowValues));
} else {
final Axis axis = axes[axisOrdinal];
int k = -1;
int saveLength = rowValues.size();
for (Position position : axis.getPositions()) {
coords[axisOrdinal] = ++k;
for (Member member : position) {
rowValues.add(member.getUniqueName());
}
outputFlattenedRecurse(result, rows, rowValues, coords, axisOrdinal + 1);
while (rowValues.size() > saveLength) {
rowValues.remove(rowValues.size() - 1);
}
}
}
}
Aggregations