org.olap4j
Interface CellSet

All Superinterfaces:
OlapWrapper, java.sql.ResultSet, java.sql.Wrapper

public interface CellSet
extends java.sql.ResultSet, OlapWrapper

Result of executing an OLAP Statement.

An consists of a set of (typically two) axes, each populated with a sequence of members, and a collection of cells at the intersection of these axes.

Cell ordinals and coordinates

There are two ways to identify a particular cell: ordinal and coordinates. Suppose that there are p axes, and each axis k (k between 0 and p - 1) has Uk positions. There are U = U0 * ... * Up - 1 cells in total. Then:

The ordinal number of a cell whose tuple ordinals are (S0, S1, ... Sp-1) is

Σi=0p-1 Si . Ei where E0 = 1 and Ei = Πi=0p-1 Uk

Since:
Aug 22, 2006
Version:
$Id: CellSet.java 229 2009-05-08 19:11:29Z jhyde $
Author:
jhyde

Field Summary
 
Fields inherited from interface java.sql.ResultSet
CLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE
 
Method Summary
 int coordinatesToOrdinal(java.util.List<java.lang.Integer> coordinates)
          Converts a list of cell coordinates to a cell ordinal.
 java.util.List<CellSetAxis> getAxes()
          Retrieves a list of CellSetAxis objects containing the result.
 Cell getCell(int ordinal)
          Returns the Cell at an ordinal.
 Cell getCell(java.util.List<java.lang.Integer> coordinates)
          Returns the Cell at a given set of coordinates.
 Cell getCell(Position... positions)
          Returns the Cell at the intersection of a set of axis positions.
 CellSetAxis getFilterAxis()
          Retrieves the CellSetAxis representing the filter axis.
 CellSetMetaData getMetaData()
          Retrieves the description of this CellSet's axes and cells.
 java.util.List<java.lang.Integer> ordinalToCoordinates(int ordinal)
          Converts a cell ordinal to a list of cell coordinates.
 
Methods inherited from interface java.sql.ResultSet
absolute, afterLast, beforeFirst, cancelRowUpdates, clearWarnings, close, deleteRow, findColumn, first, getArray, getArray, getAsciiStream, getAsciiStream, getBigDecimal, getBigDecimal, getBigDecimal, getBigDecimal, getBinaryStream, getBinaryStream, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getConcurrency, getCursorName, getDate, getDate, getDate, getDate, getDouble, getDouble, getFetchDirection, getFetchSize, getFloat, getFloat, getHoldability, getInt, getInt, getLong, getLong, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getObject, getObject, getObject, getObject, getRef, getRef, getRow, getRowId, getRowId, getShort, getShort, getSQLXML, getSQLXML, getStatement, getString, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getType, getUnicodeStream, getUnicodeStream, getURL, getURL, getWarnings, insertRow, isAfterLast, isBeforeFirst, isClosed, isFirst, isLast, last, moveToCurrentRow, moveToInsertRow, next, previous, refreshRow, relative, rowDeleted, rowInserted, rowUpdated, setFetchDirection, setFetchSize, updateArray, updateArray, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateClob, updateClob, updateClob, updateClob, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNString, updateNString, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, updateRow, updateRowId, updateRowId, updateShort, updateShort, updateSQLXML, updateSQLXML, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp, wasNull
 
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
 
Methods inherited from interface org.olap4j.OlapWrapper
isWrapperFor, unwrap
 

Method Detail

getMetaData

CellSetMetaData getMetaData()
                            throws OlapException
Retrieves the description of this CellSet's axes and cells.

Specified by:
getMetaData in interface java.sql.ResultSet
Returns:
the description of this CellSet's axes and cells
Throws:
OlapException - if a database access error occurs

getAxes

java.util.List<CellSetAxis> getAxes()
Retrieves a list of CellSetAxis objects containing the result.

The list contains axes according to their ordinal: 0 is the columns axis, 1 the rows axis, and so forth.

Returns:
list of CellSetAxis objects containing the result

getFilterAxis

CellSetAxis getFilterAxis()
Retrieves the CellSetAxis representing the filter axis.

This axis always has one row, and contains one member for each dimension not included in any other axis. Some of these dimensions may have been explicitly mentioned in the WHERE clause of the MDX statement; others dimensions are represented by their default member.

Returns:
the filter axis

getCell

Cell getCell(java.util.List<java.lang.Integer> coordinates)
Returns the Cell at a given set of coordinates.

Parameters:
coordinates - List of 0-based coordinates of the cell
Returns:
Cell
Throws:
java.lang.IndexOutOfBoundsException - if coordinates are outside CellSet bounds

getCell

Cell getCell(int ordinal)
Returns the Cell at an ordinal.

Equivalent to

getCell(ordinalToCoordinates(ordinal))

Parameters:
ordinal - 0-based ordinal of the cell
Returns:
Cell
Throws:
java.lang.IndexOutOfBoundsException - if ordinal lies outside CellSet bounds

getCell

Cell getCell(Position... positions)
Returns the Cell at the intersection of a set of axis positions.

Equivalent to


 getCell(
     Arrays.asList(
         positions[0].ordinal(),
         positions[1].ordinal() [, ...]))
 

Parameters:
positions - Array of positions
Returns:
Cell
Throws:
java.lang.IllegalArgumentException - if positions does not have the same number of members as the cell set has axes
java.lang.IndexOutOfBoundsException - if positions lie outside CellSet bounds

ordinalToCoordinates

java.util.List<java.lang.Integer> ordinalToCoordinates(int ordinal)
Converts a cell ordinal to a list of cell coordinates.

Parameters:
ordinal - Cell ordinal
Returns:
Cell coordinates

coordinatesToOrdinal

int coordinatesToOrdinal(java.util.List<java.lang.Integer> coordinates)
Converts a list of cell coordinates to a cell ordinal.

Parameters:
coordinates - Cell coordinates
Returns:
Cell ordinal

SourceForge.net_Logo