cern.colt.matrix
Class ObjectFactory3D

java.lang.Object
  extended by cern.colt.PersistentObject
      extended by cern.colt.matrix.ObjectFactory3D
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class ObjectFactory3D
extends PersistentObject

Factory for convenient construction of 3-d matrices holding Object cells. Use idioms like ObjectFactory3D.dense.make(4,4,4) to construct dense matrices, ObjectFactory3D.sparse.make(4,4,4) to construct sparse matrices. If the factory is used frequently it might be useful to streamline the notation. For example by aliasing:

ObjectFactory3D F = ObjectFactory3D.dense;
F.make(4,4,4);
...

Author:
wolfgang.hoschek@cern.ch
See Also:
Serialized Form

Field Summary
static ObjectFactory3D dense
          A factory producing dense matrices.
static ObjectFactory3D sparse
          A factory producing sparse matrices.
 
Fields inherited from class cern.colt.PersistentObject
serialVersionUID
 
Constructor Summary
protected ObjectFactory3D()
          Makes this class non instantiable, but still let's others inherit from it.
 
Method Summary
 ObjectMatrix3D make(int slices, int rows, int columns)
          Constructs a matrix with the given shape, each cell initialized with zero.
 ObjectMatrix3D make(int slices, int rows, int columns, java.lang.Object initialValue)
          Constructs a matrix with the given shape, each cell initialized with the given value.
 ObjectMatrix3D make(java.lang.Object[][][] values)
          Constructs a matrix with the given cell values.
 
Methods inherited from class cern.colt.PersistentObject
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dense

public static final ObjectFactory3D dense
A factory producing dense matrices.


sparse

public static final ObjectFactory3D sparse
A factory producing sparse matrices.

Constructor Detail

ObjectFactory3D

protected ObjectFactory3D()
Makes this class non instantiable, but still let's others inherit from it.

Method Detail

make

public ObjectMatrix3D make(java.lang.Object[][][] values)
Constructs a matrix with the given cell values. values is required to have the form values[slice][row][column] and have exactly the same number of slices, rows and columns as the receiver.

The values are copied. So subsequent changes in values are not reflected in the matrix, and vice-versa.

Parameters:
values - the values to be filled into the cells.
Returns:
this (for convenience only).
Throws:
java.lang.IllegalArgumentException - if values.length != slices() || for any 0 <= slice < slices(): values[slice].length != rows().
java.lang.IllegalArgumentException - if for any 0 <= column < columns(): values[slice][row].length != columns().

make

public ObjectMatrix3D make(int slices,
                           int rows,
                           int columns)
Constructs a matrix with the given shape, each cell initialized with zero.


make

public ObjectMatrix3D make(int slices,
                           int rows,
                           int columns,
                           java.lang.Object initialValue)
Constructs a matrix with the given shape, each cell initialized with the given value.