net.esper.view.stat.olap
Class CubeImpl

java.lang.Object
  extended by net.esper.view.stat.olap.CubeImpl
All Implemented Interfaces:
Serializable, MetaDefItem, Cube

public final class CubeImpl
extends Object
implements Cube, MetaDefItem

Cube implementation derives the cells of the cube from a measures list and a MultidimCube containing BaseStatisticsBean.

See Also:
Serialized Form

Constructor Summary
CubeImpl(MultidimCube<BaseStatisticsBean> cube, String[] measuresToDerive)
          Constructor.
 
Method Summary
 Dimension[] getDimensions()
          Returns dimensions.
 Cell[] getMeasures()
          Returns all measures.
 DimensionMember[] getMembers(int ordinal)
          Returns the member value for each dimension that intersect to identify the cell of the given ordinal.
 int getOrdinal(DimensionMember[] members)
          Given the the members of each dimension that define the intersection, returns the ordinal of a measure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CubeImpl

public CubeImpl(MultidimCube<BaseStatisticsBean> cube,
                String[] measuresToDerive)
Constructor. Takes a fact cube schema and a derivation strategy to be used when a measure cube needs to be derived.

Parameters:
cube - contains the fact cube and related into
measuresToDerive - a list of well-named measures to derive
Method Detail

getDimensions

public final Dimension[] getDimensions()
Description copied from interface: Cube
Returns dimensions. Implementations have at least 1 dimension and can be n-dimensional.

Specified by:
getDimensions in interface Cube
Returns:
dimension array

getMeasures

public final Cell[] getMeasures()
Description copied from interface: Cube
Returns all measures. Individual measures can be retrieved directly by indexing into the array of measures. A formual for calculating an ordinal for a 3-dimensional cube is as follows: ordinal = dimension[0].index + dimension[1].index * dimension[0].size + dimension[2].index * dimension[0].size * dimension[1].size;

Specified by:
getMeasures in interface Cube
Returns:
array of measures

getMembers

public final DimensionMember[] getMembers(int ordinal)
Description copied from interface: Cube
Returns the member value for each dimension that intersect to identify the cell of the given ordinal.

Specified by:
getMembers in interface Cube
Parameters:
ordinal - is the cell ordinal, starting at zero and with a max value of Cell[].length - 1.
Returns:
member values matching the number of dimensions that intersect to identify the cell

getOrdinal

public final int getOrdinal(DimensionMember[] members)
Description copied from interface: Cube
Given the the members of each dimension that define the intersection, returns the ordinal of a measure.

Specified by:
getOrdinal in interface Cube
Parameters:
members - is an array of members within each dimension that intersect and thus define the cell position
Returns:
ordinal starts at zero and ends at Cell[].length - 1. A -1 is returned if the intersection could not be determined, such as when a dimension member could not be located.

© 2007 EsperTech Inc.
All rights reserved.
Visit us at espertech.com