Interface Cell
-
public interface Cell
Cell returned from aCellSet
.- Since:
- Aug 22, 2006
- Author:
- jhyde
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.sql.ResultSet
drillThrough()
Drills through from this cell to the underlying fact table data, and returns aResultSet
of the results.CellSet
getCellSet()
Returns theCellSet
that this Cell belongs to.java.util.List<java.lang.Integer>
getCoordinateList()
Returns the coordinates of this Cell in itsCellSetAxis
.double
getDoubleValue()
Returns the value of this cell as adouble
value.java.lang.String
getErrorText()
Returns the error message of this Cell, or null if the cell is not in error.java.lang.String
getFormattedValue()
Returns the value of this Cell, formatted according to the FORMAT_STRING property and using the numeric formatting tokens the current locale.int
getOrdinal()
Returns the ordinal of this Cell.java.lang.Object
getPropertyValue(Property property)
Returns the value of a given property for this Cell.java.lang.Object
getValue()
Returns the value of this Cell.boolean
isEmpty()
Returns whether this cell is empty.boolean
isError()
Returns whether an error occurred while evaluating this cell.boolean
isNull()
Returns whether the value of this cell is NULL.void
setValue(java.lang.Object value, AllocationPolicy allocationPolicy, java.lang.Object... allocationArgs)
Sets the value of a cell.
-
-
-
Method Detail
-
getCellSet
CellSet getCellSet()
Returns theCellSet
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
java.util.List<java.lang.Integer> getCoordinateList()
Returns the coordinates of this Cell in itsCellSetAxis
.This method is provided for convenience. It is equivalent to the following code:
getResult().ordinalToCoordinateList(getOrdinal())
- Returns:
- Coordinates of this Cell
-
getPropertyValue
java.lang.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 byCellSetMetaData.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 adouble
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
java.lang.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
java.lang.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:
getDoubleValue()
-
getFormattedValue
java.lang.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 Javanull
value but this method will return the empty string""
.- Returns:
- Formatted value of this Cell
-
drillThrough
java.sql.ResultSet drillThrough() throws OlapException
Drills through from this cell to the underlying fact table data, and returns aResultSet
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(java.lang.Object value, AllocationPolicy allocationPolicy, java.lang.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 asAllocationPolicy.EQUAL_ALLOCATION
, do not require any additional arguments, in which caseallocationArgs
may benull
.- Parameters:
value
- Cell valueallocationPolicy
- Allocation policyallocationArgs
- Allocation policy arguments- Throws:
OlapException
- if a database error occurs
-
-