Package org.olap4j

Interface Cell


public interface Cell
Cell returned from a CellSet.
Since:
Aug 22, 2006
Author:
jhyde
  • Method Details

    • getCellSet

      CellSet getCellSet()
      Returns the CellSet that this Cell belongs to.
      Returns:
      CellSet, never null
    • getOrdinal

      int getOrdinal()
      Returns the ordinal of this Cell.

      The formula is the sequence, zero-based, which the cell would be visited in a raster-scan through all of the cells of this CellSet. The ordinal of the first cell is zero, and the ordinal of the last cell is the product of the lengths of the axes, minus 1. For example, if a result has 10 columns and 20 rows, then:

      • (row 0, column 0) has ordinal 0,
      • (row 0, column 1) has ordinal 1,
      • (row 1, column 0) has ordinal 10,
      • (row 19, column 9) has ordinal 199.
      Returns:
      Ordinal of this Cell
    • getCoordinateList

      List<Integer> getCoordinateList()
      Returns the coordinates of this Cell in its CellSetAxis.

      This method is provided for convenience. It is equivalent to the following code:

      getResult().ordinalToCoordinateList(getOrdinal())
      Returns:
      Coordinates of this Cell
    • getPropertyValue

      Object getPropertyValue(Property property)
      Returns the value of a given property for this Cell.

      The list of allowable properties may be obtained by calling CellSet.getMetaData() followed by CellSetMetaData.getCellProperties().

      Every cell has certain system properties such as "VALUE" and "FORMAT_STRING" (the full list is described in the Property.StandardCellProperty enumeration), as well as extra properties defined by the query.

      Parameters:
      property - Property whose value to retrieve
      Returns:
      Value of the given property for this Cell; if the property is not set, returns null
    • isEmpty

      boolean isEmpty()
      Returns whether this cell is empty.
      Returns:
      Whether this cell is empty.
    • isError

      boolean isError()
      Returns whether an error occurred while evaluating this cell.
      Returns:
      Whether an error occurred while evaluating this cell.
    • isNull

      boolean isNull()
      Returns whether the value of this cell is NULL.
      Returns:
      Whether the value of this cell is NULL.
    • getDoubleValue

      double getDoubleValue() throws OlapException
      Returns the value of this cell as a double value.

      Not all values can be represented as using the Java double, therefore for some providers, getValue() may return a more accurate result.

      Returns:
      The value of this cell; if the cell is null, the returns 0
      Throws:
      OlapException - if this cell does not have a numeric value
    • getErrorText

      String getErrorText()
      Returns the error message of this Cell, or null if the cell is not in error.

      If the cell is an error, the value will be an OlapException. (This value is returned, not thrown.)

      Returns:
      value of this Cell
    • getValue

      Object getValue()
      Returns the value of this Cell.

      If the cell is an error, the value will be an OlapException. (This value is returned, not thrown.)

      If the cell has a numeric value, returns an object which implements the Number interface.

      Returns:
      value of this Cell
      See Also:
    • getFormattedValue

      String getFormattedValue()
      Returns the value of this Cell, formatted according to the FORMAT_STRING property and using the numeric formatting tokens the current locale.

      The formatted value is never null. In particular, when the cell contains the MDX NULL value, getValue() will return the Java null value but this method will return the empty string "".

      Returns:
      Formatted value of this Cell
    • drillThrough

      ResultSet drillThrough() throws OlapException
      Drills through from this cell to the underlying fact table data, and returns a ResultSet of the results.

      If drill-through is not possible, returns null.

      Returns:
      result set of the fact rows underlying this Cell
      Throws:
      OlapException - if a database error occurs
    • setValue

      void setValue(Object value, AllocationPolicy allocationPolicy, Object... allocationArgs) throws OlapException
      Sets the value of a cell.

      When this method may be called depends on the provider. But typically, the connection must at least have an active scenario; see OlapConnection.setScenario(Scenario).

      The number and type of additional arguments specified in the allocationArgs parameter depends on the allocation policy chosen. Some policies, such as AllocationPolicy.EQUAL_ALLOCATION, do not require any additional arguments, in which case allocationArgs may be null.

      Parameters:
      value - Cell value
      allocationPolicy - Allocation policy
      allocationArgs - Allocation policy arguments
      Throws:
      OlapException - if a database error occurs