org.jscience.util.mapper
Class MappableArray

java.lang.Object
  extended by org.jscience.util.mapper.MappableArray
All Implemented Interfaces:
ArraySliceMappable

public class MappableArray
extends java.lang.Object
implements ArraySliceMappable

Wrapper class around an array in order to have it implement the ArraySliceMappable interface.


Constructor Summary
MappableArray(double[] array, boolean doReallocate)
          Simple constructor.
MappableArray(int dimension)
          Simple constructor.
 
Method Summary
 double[] getArray()
          Get the array stored in the instance.
 int getStateDimension()
          Get the dimension of the internal array.
 void mapStateFromArray(int start, double[] array)
          Reinitialize internal state from the specified array slice data.
 void mapStateToArray(int start, double[] array)
          Store internal state data into the specified array slice.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MappableArray

public MappableArray(int dimension)
Simple constructor. Build a mappable array from its dimension

Parameters:
dimension - dimension of the array

MappableArray

public MappableArray(double[] array,
                     boolean doReallocate)
Simple constructor. Build a mappable array from an existing array

Parameters:
array - array to use
doReallocate - true if a new array should be allocated and initialized using the other argument, false if the instance should reference the existing array throughout its lifetime
Method Detail

getArray

public double[] getArray()
Get the array stored in the instance.

Returns:
array stored in the instance

getStateDimension

public int getStateDimension()
Get the dimension of the internal array.

Specified by:
getStateDimension in interface ArraySliceMappable
Returns:
dimension of the array

mapStateFromArray

public void mapStateFromArray(int start,
                              double[] array)
Reinitialize internal state from the specified array slice data.

Specified by:
mapStateFromArray in interface ArraySliceMappable
Parameters:
start - start index in the array
array - array holding the data to extract

mapStateToArray

public void mapStateToArray(int start,
                            double[] array)
Store internal state data into the specified array slice.

Specified by:
mapStateToArray in interface ArraySliceMappable
Parameters:
start - start index in the array
array - array where data should be stored