fr.ifremer.isisfish.simulator
Class SimulationVariable

java.lang.Object
  extended by fr.ifremer.isisfish.simulator.SimulationVariable

public class SimulationVariable
extends Object

Object containing cached variable value for a specific entity.

Since:
4.1.0.0 Last update : $Date: 2012-04-03 15:31:36 +0200 (Tue, 03 Apr 2012) $ By : $Author: echatellier $
Version:
$Revision: 3671 $
Author:
chatellier

Field Summary
protected  SimulationContext simulationContext
          Simulation context (to get db).
protected  org.nuiton.topia.persistence.TopiaEntity topiaEntity
          Managed entity id.
protected  Map<String,Variable> variablesCache
          Variable name > variable entity.
 
Constructor Summary
SimulationVariable(SimulationContext simulationContext, org.nuiton.topia.persistence.TopiaEntity topiaEntity)
           
 
Method Summary
 double eval(String name)
          Eval current variable equation.
protected  double eval(Variable v)
          Eval current variable equation.
 double getAsDouble(String name)
          Return variable value as double.
 org.nuiton.math.matrix.MatrixND getAsMatrix(String name)
          Return variable value as matrix.
protected  Variable getVariableEntity(String name)
          Return variable entity from cache or database.
 void set(String name, Object value)
          Set variable value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

simulationContext

protected SimulationContext simulationContext
Simulation context (to get db).


topiaEntity

protected org.nuiton.topia.persistence.TopiaEntity topiaEntity
Managed entity id.


variablesCache

protected Map<String,Variable> variablesCache
Variable name > variable entity.

Constructor Detail

SimulationVariable

public SimulationVariable(SimulationContext simulationContext,
                          org.nuiton.topia.persistence.TopiaEntity topiaEntity)
Method Detail

getVariableEntity

protected Variable getVariableEntity(String name)
                              throws org.nuiton.topia.TopiaException
Return variable entity from cache or database.

Parameters:
name - variable name to get
Returns:
variable entity
Throws:
org.nuiton.topia.TopiaException - if can't restore variable from db

getAsDouble

public double getAsDouble(String name)
                   throws org.nuiton.topia.TopiaException
Return variable value as double.

Parameters:
name - variable name
Returns:
value as double
Throws:
org.nuiton.topia.TopiaException - if can't restore variable from db

getAsMatrix

public org.nuiton.math.matrix.MatrixND getAsMatrix(String name)
                                            throws org.nuiton.topia.TopiaException
Return variable value as matrix.

Parameters:
name - variable name
Returns:
value as matrix
Throws:
org.nuiton.topia.TopiaException - if can't restore variable from db

set

public void set(String name,
                Object value)
         throws org.nuiton.topia.TopiaException
Set variable value.

Parameters:
name - variable name
value - new value
Throws:
org.nuiton.topia.TopiaException - if can't restore variable from db

eval

public double eval(String name)
            throws org.nuiton.topia.TopiaException
Eval current variable equation.

Parameters:
name - variable name
Returns:
equation result
Throws:
org.nuiton.topia.TopiaException - if can't restore variable from db

eval

protected double eval(Variable v)
Eval current variable equation.

Parameters:
v - variable
Returns:
equation result


Copyright © 1999-2012 CodeLutin. All Rights Reserved.