net.sf.molae.pipe.cube
Interface Cube<E,T>

All Known Implementing Classes:
AbstractCube, CubeProxy, MapBasedCube, TableModelAsCube, VaryingCube

public interface Cube<E,T>

A hypercube.

Since:
1.1

Method Summary
 boolean equals(Object o)
          Compares the specified object with this cube for equality.
 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.
 Cube<E,T> getProjection(int index, E pivot)
          Returns a projection of this cube.
 int hashCode()
          Returns the hash code value for this cube.
 void put(List<E> location, T value)
          Sets the element at the specified location to the specified value.
 

Method Detail

getEdges

List<Collection<? extends E>> getEdges()
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. The returned list is intended to be unmodifiable, but implementations can also use modifiable lists.

Returns:
the possible index values of each dimension.

get

T get(List<E> location)
Returns the element at the specified location.

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

void put(List<E> location,
         T value)
Sets the element at the specified location to the specified value.

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

Cube<E,T> getProjection(int index,
                        E pivot)
Returns a projection of this cube. A projection is a cube where one dimension of the original cube has a fixed value so that the resulting cube (the projection) has one dimension less than the original cube.

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()).

equals

boolean equals(Object o)
Compares the specified object with this cube for equality. Returns true if the given object is also a cube and the two Cubes represent the same mappings. More formally, two cubes c1 and c2 represent the same mappings if new CubeAsMap(c1).equals(new CubeAsMap(c2)). This ensures that the equals method works properly across different implementations of the Cube interface.

Overrides:
equals in class Object
Parameters:
o - object to be compared for equality with this cube
Returns:
true if the specified object is equal to this cube

hashCode

int hashCode()
Returns the hash code value for this cube. The hash code of a cube c is defined to be new CubeAsMap(c).hashCode(). This ensures that c1.equals(c2) implies that c1.hashCode()==c2.hashCode() for any two cubes c1 and c2, as required by the general contract of Object.hashCode.

Overrides:
hashCode in class Object
Returns:
the hash code value for this cube