fr.ifremer.isisfish.simulator
Class SimulationContext

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

public class SimulationContext
extends Object

Keep all information on one simulation.

  • Launch parameter
  • Database (TopiaContext)
  • SimulationControl
  • Effective by pop (N)
  • Result Created: 3 juil. 2006 17:05:27

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

    Field Summary
    protected  ClassLoader classLoader
               
    protected  Map<String,Double> contextEquationValue
              Context value used in equation.
    protected  org.nuiton.topia.TopiaContext db
              TopiaContext must be used by rule action to modify data
    protected  org.nuiton.topia.TopiaContext dbResult
              TopiaContext must be used to save result
    protected  MetierMonitor metierMonitor
               
    protected  PopulationMonitor populationMonitor
               
    protected  ResultManager resultManager
               
    protected  RuleMonitor ruleMonitor
               
    protected  File scriptDirectory
               
    protected  SimulationStorage simulation
               
    protected  SimulationControl simulationControl
               
    protected  Set<SimulationListener> simulationListeners
               
    protected  Map<String,Object> values
               
    protected  Map<org.nuiton.topia.persistence.TopiaEntity,SimulationVariable> variablesCache
              Cache des variables d'entités.
     
    Constructor Summary
    protected SimulationContext()
               
     
    Method Summary
     void addSimulationListener(SimulationListener l)
              Add simulation listener, if listener is SimulationResultListener, it's automatically added as listener on ResultManager
     void closeDB()
               
     void closeDBResult()
               
     void fireAfterSimulation()
               
     void fireBeforeSimulation()
               
    static SimulationContext get()
               
     SimulationVariable get(org.nuiton.topia.persistence.TopiaEntity entity)
              Get object containing variable for given entity.
     ClassLoader getClassLoader()
               
     org.nuiton.topia.TopiaContext getDB()
              This method return TopiaContext that Rule action must used to modify data.
     org.nuiton.topia.TopiaContext getDbResult()
              this method return TopiaContext that must be used to save result
     MetierMonitor getMetierMonitor()
               
     PopulationMonitor getPopulationMonitor()
               
     ResultManager getResultManager()
               
     RuleMonitor getRuleMonitor()
               
     File getScriptDirectory()
               
     SimulationControl getSimulationControl()
               
     SimulationStorage getSimulationStorage()
               
     Object getValue(String name)
              Permet de recuperer une valeur prealablement stocker avec un setValue
     double getValueAndCompute(String key, double defaultValue)
              Return value from context.
     void message(String message)
               
    static void remove()
              remove simulation associate with current thread
     void removeSimulationListener(SimulationListener l)
              Remove simulation listener, if listener is SimulationResultListener, it's Automatically removed as listener on ResultManager
     void setClassLoader(ClassLoader classLoader)
               
     void setComputeValue(String key, Double value)
              Add value/key pair into context (computed value).
     void setScriptDirectory(File scriptDirectory)
              Script directory to use.
     void setSimulationControl(SimulationControl simulationControl)
               
     void setSimulationStorage(SimulationStorage simulation)
               
     void setValue(String name, Object value)
              Permet de stocker une valeur en fonction d'une cle, cela peut-etre util pour partager des informations entre Rule ou d'autre objet.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    values

    protected Map<String,Object> values

    simulation

    protected SimulationStorage simulation

    simulationControl

    protected SimulationControl simulationControl

    populationMonitor

    protected PopulationMonitor populationMonitor

    metierMonitor

    protected MetierMonitor metierMonitor

    ruleMonitor

    protected RuleMonitor ruleMonitor

    resultManager

    protected ResultManager resultManager

    simulationListeners

    protected Set<SimulationListener> simulationListeners

    classLoader

    protected ClassLoader classLoader

    scriptDirectory

    protected File scriptDirectory

    db

    protected org.nuiton.topia.TopiaContext db
    TopiaContext must be used by rule action to modify data


    dbResult

    protected org.nuiton.topia.TopiaContext dbResult
    TopiaContext must be used to save result


    variablesCache

    protected Map<org.nuiton.topia.persistence.TopiaEntity,SimulationVariable> variablesCache
    Cache des variables d'entités. Topia id > map of attributes.


    contextEquationValue

    protected Map<String,Double> contextEquationValue
    Context value used in equation.

    Constructor Detail

    SimulationContext

    protected SimulationContext()
    Method Detail

    get

    public static SimulationContext get()
    Returns:
    simulation context for the current simulation (current thread)

    remove

    public static void remove()
    remove simulation associate with current thread


    addSimulationListener

    public void addSimulationListener(SimulationListener l)
    Add simulation listener, if listener is SimulationResultListener, it's automatically added as listener on ResultManager

    Parameters:
    l -

    closeDB

    public void closeDB()

    closeDBResult

    public void closeDBResult()

    removeSimulationListener

    public void removeSimulationListener(SimulationListener l)
    Remove simulation listener, if listener is SimulationResultListener, it's Automatically removed as listener on ResultManager

    Parameters:
    l -

    fireBeforeSimulation

    public void fireBeforeSimulation()

    fireAfterSimulation

    public void fireAfterSimulation()

    getClassLoader

    public ClassLoader getClassLoader()
    Returns:
    Returns the classLoader.

    setClassLoader

    public void setClassLoader(ClassLoader classLoader)
    Parameters:
    classLoader - The classLoader to set.

    getValue

    public Object getValue(String name)
    Permet de recuperer une valeur prealablement stocker avec un setValue

    Parameters:
    name - le nom de la valeur souhaitée
    Returns:
    la valeur ou null si aucune valeur ne porte se nom

    setValue

    public void setValue(String name,
                         Object value)
    Permet de stocker une valeur en fonction d'une cle, cela peut-etre util pour partager des informations entre Rule ou d'autre objet.

    Parameters:
    name - le nom de la valeur
    value - la valeur

    getSimulationStorage

    public SimulationStorage getSimulationStorage()
    Returns:
    Returns the topiaContext.

    setSimulationStorage

    public void setSimulationStorage(SimulationStorage simulation)
    Parameters:
    simulation - The simulation storage to set.

    getSimulationControl

    public SimulationControl getSimulationControl()
    Returns:
    Returns the simulationControl.

    setSimulationControl

    public void setSimulationControl(SimulationControl simulationControl)
    Parameters:
    simulationControl - The simulationControl to set.

    getPopulationMonitor

    public PopulationMonitor getPopulationMonitor()
    Returns:
    Returns the populationMonitor.

    getMetierMonitor

    public MetierMonitor getMetierMonitor()
    Returns:
    Returns the metierMonitor.

    getRuleMonitor

    public RuleMonitor getRuleMonitor()
    Returns:
    Returns the ruleMonitor.

    getResultManager

    public ResultManager getResultManager()
    Returns:
    Returns the resultManager.

    getDB

    public org.nuiton.topia.TopiaContext getDB()
                                        throws org.nuiton.topia.TopiaException
    This method return TopiaContext that Rule action must used to modify data. This TopiaContext is rollbacked after each step.

    Returns:
    TopiaContext that Rule action must used
    Throws:
    org.nuiton.topia.TopiaException

    getDbResult

    public org.nuiton.topia.TopiaContext getDbResult()
                                              throws org.nuiton.topia.TopiaException
    this method return TopiaContext that must be used to save result

    Returns:
    Returns the dbResult.
    Throws:
    org.nuiton.topia.TopiaException

    getScriptDirectory

    public File getScriptDirectory()
    Returns:
    Returns the scriptDirectory.

    setScriptDirectory

    public void setScriptDirectory(File scriptDirectory)
    Script directory to use. Used to chnage isis-database-3 directory in running simulation context.

    Parameters:
    scriptDirectory -

    message

    public void message(String message)
    Parameters:
    message - message

    setComputeValue

    public void setComputeValue(String key,
                                Double value)
    Add value/key pair into context (computed value).

    Parameters:
    key - key
    value - value

    getValueAndCompute

    public double getValueAndCompute(String key,
                                     double defaultValue)
    Return value from context.

    Parameters:
    key - key
    defaultValue - default value or value to compute
    Returns:
    computed value or defaultValue if not found

    get

    public SimulationVariable get(org.nuiton.topia.persistence.TopiaEntity entity)
    Get object containing variable for given entity.

    Parameters:
    entity - entity
    Returns:
    map object for this class
    Since:
    4.1.0.0


    Copyright © 1999-2012 CodeLutin. All Rights Reserved.