fr.ifremer.isisfish.simulator
Class SimulationContext

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

public class SimulationContext
extends java.lang.Object

Keep all information on one simulation.

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

    Version:
    $Revision: 2938 $ Last update: $Date: 2010-01-22 16:42:09 +0100 (ven., 22 janv. 2010) $ by : $Author: chatellier $
    Author:
    poussin

    Field Summary
    protected  java.lang.ClassLoader classLoader
               
    protected  java.util.Map<java.lang.String,java.lang.String> contextEquationOperator
              Operator used in equation values
    protected  java.util.Map<java.lang.String,java.lang.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  java.io.File scriptDirectory
               
    protected  SimulationStorage simulation
               
    protected  SimulationControl simulationControl
               
    protected  java.util.Set<SimulationListener> simulationListeners
               
    protected  java.util.Map<java.lang.String,java.lang.Object> values
               
     
    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()
               
     java.lang.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()
               
     java.io.File getScriptDirectory()
               
     SimulationControl getSimulationControl()
               
     SimulationStorage getSimulationStorage()
               
     java.lang.Object getValue(java.lang.String name)
              Permet de recuperer une valeur prealablement stocker avec un setValue
     double getValueAndCompute(java.lang.String key, double defaultValue)
              Return value from context.
     void message(java.lang.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(java.lang.ClassLoader classLoader)
               
     void setScriptDirectory(java.io.File scriptDirectory)
              Script directory to use.
     void setSimulationControl(SimulationControl simulationControl)
               
     void setSimulationStorage(SimulationStorage simulation)
               
     void setValue(java.lang.String key, java.lang.Double value, java.lang.String operator)
              Add value/key pair into context.
     void setValue(java.lang.String name, java.lang.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 java.util.Map<java.lang.String,java.lang.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 java.util.Set<SimulationListener> simulationListeners

    classLoader

    protected java.lang.ClassLoader classLoader

    scriptDirectory

    protected java.io.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


    contextEquationValue

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


    contextEquationOperator

    protected java.util.Map<java.lang.String,java.lang.String> contextEquationOperator
    Operator used in equation values

    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 java.lang.ClassLoader getClassLoader()
    Returns:
    Returns the classLoader.

    setClassLoader

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

    getValue

    public java.lang.Object getValue(java.lang.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(java.lang.String name,
                         java.lang.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 java.io.File getScriptDirectory()
    Returns:
    Returns the scriptDirectory.

    setScriptDirectory

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

    Parameters:
    scriptDirectory -

    message

    public void message(java.lang.String message)
    Parameters:
    message - message

    setValue

    public void setValue(java.lang.String key,
                         java.lang.Double value,
                         java.lang.String operator)
    Add value/key pair into context.

    Parameters:
    key - key
    value - value
    operator - operator

    getValueAndCompute

    public double getValueAndCompute(java.lang.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


    Copyright © 1999-2010 CodeLutin. All Rights Reserved.