org.jscience.util.mapper
Class ArrayMapper

java.lang.Object
  extended by org.jscience.util.mapper.ArrayMapper

public class ArrayMapper
extends java.lang.Object

This class dispatch data between an array and several domain objects.

This class handles all the burden of mapping each domain object it handles to a slice of a single array.

See Also:
ArraySliceMappable

Constructor Summary
ArrayMapper()
          Simple constructor.
ArrayMapper(ArraySliceMappable object)
          Simple constructor.
 
Method Summary
 double[] getInternalDataArray()
          Get the internal data array.
 void manageMappable(ArraySliceMappable object)
          Take a new domain object into account.
 void updateArray()
          Map data from the domain objects to the internal array.
 void updateArray(double[] data)
          Map data from the domain objects to the specified array.
 void updateObjects()
          Map data from the internal array to the domain objects.
 void updateObjects(double[] data)
          Map data from the specified array to the domain objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayMapper

public ArrayMapper()
Simple constructor. Build an empty array mapper


ArrayMapper

public ArrayMapper(ArraySliceMappable object)
Simple constructor. Build an array mapper managing one object. Other objects can be added later using the manageMappable method. This call is equivalent to build the mapper with the default constructor and adding the object.

Parameters:
object - domain object to handle
Method Detail

manageMappable

public void manageMappable(ArraySliceMappable object)
Take a new domain object into account.

Parameters:
object - domain object to handle

getInternalDataArray

public double[] getInternalDataArray()
Get the internal data array.

Returns:
internal data array

updateObjects

public void updateObjects()
Map data from the internal array to the domain objects.


updateObjects

public void updateObjects(double[] data)
Map data from the specified array to the domain objects.

Parameters:
data - flat array holding the data to dispatch

updateArray

public void updateArray()
Map data from the domain objects to the internal array.


updateArray

public void updateArray(double[] data)
Map data from the domain objects to the specified array.

Parameters:
data - flat array where to put the data