/** * Prints the rows of cell set. * * @param cellSet Cell set * @param pw Writer * @param axis Axis ordinal * @param pos Partial coordinate */ private static void printRows(CellSet cellSet, PrintWriter pw, int axis, List<Integer> pos) { final CellSetAxis _axis = cellSet.getAxes().get(axis); final List<Position> positions = _axis.getPositions(); final int positionCount = positions.size(); for (int i = 0; i < positionCount; i++) { pos.set(axis, i); if (axis == 0) { int row = axis + 1 < pos.size() ? pos.get(axis + 1) : 0; pw.print("Row #" + row + ": "); printCell(cellSet, pw, pos); pw.println(); } else { printRows(cellSet, pw, axis - 1, pos); } } }
/** * Prints an axis and its members. * * @param pw Print writer * @param axis Axis */ private static void printAxis(PrintWriter pw, CellSetAxis axis) { List<Position> positions = axis.getPositions(); for (Position position : positions) { boolean firstTime = true; pw.print("{"); for (Member member : position.getMembers()) { if (!firstTime) { pw.print(", "); } pw.print(member.getUniqueName()); firstTime = false; } pw.println("}"); } }