net.sf.molae.pipe.cube
Class CubeProxy

java.lang.Object
  |
  +--net.sf.molae.pipe.cube.AbstractCube
        |
        +--net.sf.molae.pipe.cube.CubeProxy
All Implemented Interfaces:
Cube

public class CubeProxy
extends AbstractCube

A proxy of an underlying cube. This class is used as a default for projections in AbstractCube.getProjection(int, java.lang.Object).

Since:
1.1

Constructor Summary
CubeProxy(Cube base)
          Creates a new CubeProxy of the specified base cube.
 
Method Summary
 Object get(List location)
          Returns the element at the specified location.
 List getEdges()
          Returns the possible index values of each dimension.
protected  List getOrigin(List location)
          Calculates the location in the base cube.
 Cube getProjection(int index, Object pivot)
          Returns a projection of this cube.
 void put(List location, Object value)
          Sets the element at the specified location to the specified value.
 
Methods inherited from class net.sf.molae.pipe.cube.AbstractCube
asMap, equals, getEdge, hashCode, putAll, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CubeProxy

public CubeProxy(Cube base)
Creates a new CubeProxy of the specified base cube.
Parameters:
base - the base cube
Method Detail

getEdges

public List getEdges()
Description copied from class: AbstractCube
Returns the possible index values of each dimension. Each element of the returned list is a collection that contains all possible values for the dimension corresponding to the index in the list. This implementation returns the edges property.
Overrides:
getEdges in class AbstractCube
Following copied from class: net.sf.molae.pipe.cube.AbstractCube
Returns:
the possible index values of each dimension.

getOrigin

protected List getOrigin(List location)
Calculates the location in the base cube.
Parameters:
location - location in this projection
Returns:
the location in the base cube.
Throws:
NullPointerException - specified location is null.

get

public Object get(List location)
Description copied from class: AbstractCube
Returns the element at the specified location.
Overrides:
get in class AbstractCube
Following copied from class: net.sf.molae.pipe.cube.AbstractCube
Parameters:
location - a list of index values that determines a position int the cube
Returns:
the element at the specified location.
Throws:
NullPointerException - specified location is null.
RuntimeException - if the location is not valid (the exact type depends on the implementation).

put

public void put(List location,
                Object value)
Description copied from class: AbstractCube
Sets the element at the specified location to the specified value.
Overrides:
put in class AbstractCube
Following copied from class: net.sf.molae.pipe.cube.AbstractCube
Parameters:
location - a list of index values that determines a position int the cube
value - new value of the cell at the specified location
Throws:
UnsupportedOperationException - if this cube is not modifiable.
NullPointerException - specified location is null.
RuntimeException - if the location is not valid (the exact type depends on the implementation).

getProjection

public Cube getProjection(int index,
                          Object pivot)
Description copied from class: AbstractCube
Returns a projection of this cube. This implementation creates a CubeProxy of this object and calls the corresponding method of the proxy.
Overrides:
getProjection in class AbstractCube
Following copied from class: net.sf.molae.pipe.cube.AbstractCube
Parameters:
index - the dimension that will be fixed.
pivot - the fixed value of the fixed dimension.
Returns:
a projection of this cube.
Throws:
IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= getEdges().size()).