mondrian.rolap
Interface CellKey

All Known Implementing Classes:
CellKey.Many, CellKey.One, CellKey.Three, CellKey.Two, CellKey.Zero

public interface CellKey

A CellKey is used as a key in maps which access cells by their position.

CellKey is also used within SparseSegmentDataset to store values within aggregations.

It is important that CellKey is memory-efficient, and that the Object.hashCode() and Object.equals(java.lang.Object) methods are extremely efficient. There are particular implementations for the most likely cases where the number of axes is 1, 2 and 3 as well as a general implementation.

To create a key, call the CellKey.Generator.newCellKey(int[]) method.

Since:
10 August, 2001
Author:
jhyde
 

Nested Class Summary
static class CellKey.Generator
           
static class CellKey.Many
           
static class CellKey.One
           
static class CellKey.Three
           
static class CellKey.Two
           
static class CellKey.Zero
           
 
Method Summary
 CellKey copy()
          Returns a mutable copy of this CellKey.
 int getAxis(int axis)
          Returns the axisth axis value.
 int[] getOrdinals()
          Returns the axis keys as an array.
 void setAxis(int axis, int value)
          Sets a given axis.
 void setOrdinals(int[] pos)
          This method make a copy of the int array parameter.
 int size()
          Returns the number of axes.
 

Method Detail

size

int size()
Returns the number of axes.

Returns:
number of axes

getOrdinals

int[] getOrdinals()
Returns the axis keys as an array.

Note: caller should treat the array as immutable. If the contents of the array are modified, behavior is unspecified.

Returns:
Array of axis keys

setOrdinals

void setOrdinals(int[] pos)
This method make a copy of the int array parameter. Throws a RuntimeException if the int array size is not the size of the CellKey.

Parameters:
pos - Array of axis keys

getAxis

int getAxis(int axis)
Returns the axisth axis value.

Throws:
ArrayIndexOutOfBoundsException - if axis is out of range
Parameters:
axis - Axis ordinal
Returns:
Value of the axisth axis

setAxis

void setAxis(int axis,
             int value)
Sets a given axis.

Throws:
RuntimeException - if axis parameter is larger than size()
Parameters:
axis - Axis ordinal
value - Value

copy

CellKey copy()
Returns a mutable copy of this CellKey.

Returns:
Mutable copy

SourceForge.net_Logo