org.jscience.util.mapper
Interface ArraySliceMappable

All Known Implementing Classes:
MappableArray, MappableScalar

public interface ArraySliceMappable

This interface is used to map objects to and from simple arrays.

Lots of mathematical algorithms are generic ones which can process the data from domain objects despite they ignore what this data represent. As an example, the same algorithm can integrate either the orbit evolution of a spacecraft under a specified force model or the electrical characteristics of a circuit after a switch is opened.

The approach of the Mantissa library is to define an interface for each such algorithm to represent the type of problem they can handle (FirstOrderDifferentialEquations for an ODE integrators, EstimationProblem for least squares estimators, ...). Furthermore, the state data that is handled by these algorithms is often a mixture of data coming from several domain objects (the orbit, plus the aerodynamical coefficients of the spacecraft, plus the characteristics of the thrusters, plus ...). Therefore, the user needs to gather and dispatch data between different objects representing different levels of abstraction.

This interface is designed to copy data back and forth between existing objects during the iterative processing of these algorithms and avoid the cost of recreating the objects.

The nominal way to use this interface is to have the domain objects implement it (either directly or using inheritance to add this feature to already existing objects) and to create one class that implements the problem interface (for example FirstOrderDifferentialEquations) and uses the ArrayMapper class to dispatch the data to and from the domain objects.

See Also:
ArrayMapper

Method Summary
 int getStateDimension()
          Get the dimension of the object.
 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.
 

Method Detail

getStateDimension

int getStateDimension()
Get the dimension of the object.

Returns:
dimension of the object

mapStateFromArray

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

Parameters:
start - start index in the array
array - array holding the data to extract

mapStateToArray

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

Parameters:
start - start index in the array
array - array where data should be stored