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

java.lang.Object
  extended by net.sf.molae.pipe.cube.AbstractCube<E,T>
      extended by net.sf.molae.pipe.cube.VaryingCube<E,T>
All Implemented Interfaces:
Cube<E,T>
Direct Known Subclasses:
MapBasedCube

public abstract class VaryingCube<E,T>
extends AbstractCube<E,T>

Parent class for cube implementations where the dimension (the number of edges) can vary.

Since:
1.1

Constructor Summary
protected VaryingCube()
          Constructs a new AbstractCube.
  VaryingCube(List<Set<E>> edgesBase)
          Constructs a new VaryingCube.
 
Method Summary
protected  void adjustEdges(List<E> location)
          Modifies the edgesBase property so that it contains the specified location.
protected  List<Set<E>> getEdgesBase()
          Returns the edgesBase property.
protected  Set<E> newEdge()
          Creates a new collection to contain edge values.
 
Methods inherited from class net.sf.molae.pipe.cube.AbstractCube
asMap, equals, get, getEdge, getEdges, getProjection, hashCode, put, putAll, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VaryingCube

public VaryingCube(List<Set<E>> edgesBase)
Constructs a new VaryingCube.

Parameters:
edgesBase - internal list containing the edges

VaryingCube

protected VaryingCube()
Constructs a new AbstractCube.

Method Detail

getEdgesBase

protected List<Set<E>> getEdgesBase()
Returns the edgesBase property. In contrast to AbstractCube.getEdges() this method returns a modifiable handle.

Returns:
the edgeBase property.

newEdge

protected Set<E> newEdge()
Creates a new collection to contain edge values. Used by adjustEdges(List). This implementation returns a HashSet.

Returns:
a new collection to contain edge values.

adjustEdges

protected void adjustEdges(List<E> location)
Modifies the edgesBase property so that it contains the specified location. Intended to be called from AbstractCube.put(java.util.List, T). The edgesBase must only contain sets.

Parameters:
location - a list of index values that determines a position in the cube
Throws:
ClassCastException - if an edge is not a Set.