net.sf.molae.pipe.cube
Class TableModelAsCube

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

public class TableModelAsCube
extends AbstractCube<Integer,Object>

TableModel based cube.

Since:
1.1

Constructor Summary
TableModelAsCube(TableModel base)
          Constructs a new TableModelBasedCube.
 
Method Summary
 Object get(List<Integer> location)
          Returns the element at the specified location.
 List<Collection<? extends Integer>> getEdges()
          Returns the possible index values of each dimension.
 void put(List<Integer> 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, getProjection, hashCode, putAll, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TableModelAsCube

public TableModelAsCube(TableModel base)
Constructs a new TableModelBasedCube.

Parameters:
base - base TableModel
Throws:
NullPointerException - if any parameter is null.
Method Detail

getEdges

public List<Collection<? extends Integer>> 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<Integer,Object>
Overrides:
getEdges in class AbstractCube<Integer,Object>
Returns:
the possible index values of each dimension.

get

public Object get(List<Integer> location)
Returns the element at the specified location.

Specified by:
get in interface Cube<Integer,Object>
Specified by:
get in class AbstractCube<Integer,Object>
Parameters:
location - a list containing two Integers representing the rowIndex and columnIndex
Returns:
the element at the specified location.
Throws:
ClassCastException - if the first or second element of location is not an Integer.
IndexOutOfBoundsException - if either location does not contain two elements or the contained row or column are out of bounds.

put

public void put(List<Integer> location,
                Object value)
Sets the element at the specified location to the specified value.

Specified by:
put in interface Cube<Integer,Object>
Specified by:
put in class AbstractCube<Integer,Object>
Parameters:
location - a list containing two Integers representing the rowIndex and columnIndex
value - new value of the cell at the specified location
Throws:
ClassCastException - if the first or second element of location is not an Integer.
IndexOutOfBoundsException - if either location does not contain two elements or the contained row or column are out of bounds.