Package org.olap4j

Interface CellSetAxis

All Superinterfaces:
Iterable<Position>

public interface CellSetAxis extends Iterable<Position>
Axis of a CellSet.

A cell set has the same number of axes as the MDX statement which was executed to produce it. For example, a typical cell set, resulting from an MDX query with COLUMNS and ROWS expressions is two-dimensional, and therefore has two axes.

Each axis is an ordered collection of members or tuples. Each member or tuple on an axis is called a Position.

The positions on the cell set axis can be accessed sequentially or random-access. Use the getPositions() method to return a list for random access, or the iterator() method to obtain an iterator for sequential access.

Since:
Aug 22, 2006
Author:
jhyde
  • Method Details

    • getAxisOrdinal

      Axis getAxisOrdinal()
      Returns the axis ordinal of this CellSetAxis.

      The first axis in a CellSet will return Axis.COLUMNS, the second Axis.ROWS, and so forth, as described by the Axis.axisOrdinal() method of the Axis enumeration.

      Returns:
      the ordinal of this axis
    • getCellSet

      CellSet getCellSet()
      Returns the CellSet which this CellSetAxis belongs to.
      Returns:
      the CellSet
    • getAxisMetaData

      CellSetAxisMetaData getAxisMetaData()
      Returns a description of the type (e.g. Axis.ROWS) of this axis, and the hierarchies and properties which will be found on it.

      The result is identical to evaluating

      getCellSet().getMetaData().getSlicerAxisMetaData()
      for a filter axis, and
      getCellSet().getMetaData().getAxesMetaData().get( getAxisOrdinal().axisOrdinal())
      for other axes.
      Returns:
      metadata describing this CellSetAxis
    • getPositions

      List<Position> getPositions()
      Returns a list of Position objects on this CellSetAxis.
      Returns:
      List of positions on this axis (never null)
    • getPositionCount

      int getPositionCount()
      Returns the number of positions on this CellSetAxis.

      This method can be called at any time. In particular, it is not necessary to complete an iteration through all positions before calling this method.

      The number of positions on an axis is important when computing the ordinal of a cell.

      Returns:
      the number of positions
    • iterator

      ListIterator<Position> iterator()
      Opens an iterator over the positions on this CellSetAxis.

      If this axis has very many positions, this method may be more efficient than getPositions().

      This method allows CellSetAxis to implement the Iterable interface, so one might use it in a foreach construct, for example:

       CellSet cellSet;
       for (Position rowPos : cellSet.getAxes().get(0)) {
           for (Position colPos : cellSet.getAxes().get(1)) {
                Cell cell = cellSet.getCell(colPos, rowPos);
                ....
           }
       }
      Specified by:
      iterator in interface Iterable<Position>
      Returns:
      iterator over the collection of positions