net.sourceforge.jabm
Class SpringSimulationController
java.lang.Object
net.sourceforge.jabm.event.AbstractModel
net.sourceforge.jabm.SimulationController
net.sourceforge.jabm.SpringSimulationController
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Runnable, Model, EventScheduler, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
- GameTheoreticSimulationController
public class SpringSimulationController
- extends SimulationController
- implements org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean
SpringSimulationController
is responsible for running
one or more independent JABM simulations which are configured using the
Spring Framework.
It is responsible for running one or more Monte-carlo simulations; that is,
any object implementing the Simulation
interface.
Typically a simulation will be run several hundred times with different
realisations of random variables. In order to ensure that each sample
is independent, the underlying simulation is initialised as a freshly
constructed bean from the Spring factory for every run.
A simulation model is constructed using
dependency injection
by creating a
Spring beans configuration file which specifies which classes to use
in the simulation and the values of any attributes (parameters).
The Spring configuration file is specified using the system property
jabm.config
.
- See Also:
Simulation
,
Serialized Form-
-
Methods inherited from class net.sourceforge.jabm.SimulationController |
addReport, fireEvent, getModelDescription, getNumSimulations, getPopulation, getReports, getSimulation, getSimulationFactory, getSimulationTime, getSlowSleepInterval, isRunning, run, runSingleSimulation, setListeners, setModelDescription, setNumSimulations, setReports, setSimulation, setSimulationFactory, setSlowSleepInterval, slow, terminate, wireReports, wireSimulation |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
simulationBeanName
protected java.lang.String simulationBeanName
- The name of the bean representing the Simulation.
simulationScope
protected SimulationScope simulationScope
- The container for beans with scope="simulation".
beanFactory
protected org.springframework.beans.factory.BeanFactory beanFactory
simulationInitialised
protected boolean simulationInitialised
SpringSimulationController
public SpringSimulationController()
tearDownSimulation
protected void tearDownSimulation()
- Description copied from class:
SimulationController
- Remove listeners prior to reconstructing the simulation object.
- Overrides:
tearDownSimulation
in class SimulationController
constructSimulation
protected void constructSimulation()
- Specified by:
constructSimulation
in class SimulationController
getSimulationBeanName
public java.lang.String getSimulationBeanName()
setSimulationBeanName
public void setSimulationBeanName(java.lang.String simulationBean)
- The name of bean representing the Simulation to be run
as part of this experiment.
- Parameters:
simulationBean
- - See Also:
Simulation
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
throws org.springframework.beans.BeansException
- Specified by:
setBeanFactory
in interface org.springframework.beans.factory.BeanFactoryAware
- Throws:
org.springframework.beans.BeansException
getBeanFactory
public org.springframework.beans.factory.BeanFactory getBeanFactory()
afterPropertiesSet
public void afterPropertiesSet()
throws java.lang.Exception
- Specified by:
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
- Throws:
java.lang.Exception