net.sf.molae.pipe.cube
Class CubeProxy<E,T>

java.lang.Object
  extended by net.sf.molae.pipe.cube.AbstractCube<E,T>
      extended by net.sf.molae.pipe.cube.CubeProxy<E,T>
All Implemented Interfaces:
Cube<E,T>

public class CubeProxy<E,T>
extends AbstractCube<E,T>

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

Since:
1.1

Constructor Summary
CubeProxy(Cube<E,T> base)
          Creates a new CubeProxy of the specified base cube.
 
Method Summary
 T get(List<E> location)
          Returns the element at the specified location.
 List<Collection<? extends E>> getEdges()
          Returns the possible index values of each dimension.
protected  List<E> getOrigin(List<E> location)
          Calculates the location in the base cube.
 Cube<E,T> getProjection(int index, E pivot)
          Returns a projection of this cube.
 void put(List<E> location, T 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<E,T> base)
Creates a new CubeProxy of the specified base cube.

Parameters:
base - the base cube
Method Detail

getEdges

public List<Collection<? extends E>> 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.

Specified by:
getEdges in interface Cube<E,T>
Overrides:
getEdges in class AbstractCube<E,T>
Returns:
the possible index values of each dimension.

getOrigin

protected List<E> getOrigin(List<E> 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 T get(List<E> location)
Description copied from class: AbstractCube
Returns the element at the specified location.

Specified by:
get in interface Cube<E,T>
Specified by:
get in class AbstractCube<E,T>
Parameters:
location - a list of index values that determines a position int the cube
Returns:
the element at the specified location.

put

public void put(List<E> location,
                T value)
Description copied from class: AbstractCube
Sets the element at the specified location to the specified value.

Specified by:
put in interface Cube<E,T>
Specified by:
put in class AbstractCube<E,T>
Parameters:
location - a list of index values that determines a position int the cube
value - new value of the cell at the specified location

getProjection

public Cube<E,T> getProjection(int index,
                               E 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.

Specified by:
getProjection in interface Cube<E,T>
Overrides:
getProjection in class AbstractCube<E,T>
Parameters:
index - the dimension that will be fixed.
pivot - the fixed value of the fixed dimension.
Returns:
a projection of this cube.