gsim.core.runtime
Interface ScenarioManager


public interface ScenarioManager

The ScenarioManager is the interface between a client (local or remote) and the simulation engine. It manages the setup and the number of repetitions of a model.

A model is identified by its namespace. For each model (simulation is a synonym), depending on the number of runs, several simulation instances may exist at the same time. Each of them gets assigned a unique identifier, the SimulationID. With this identifier a reference to a single simulation instance can be obtained.

A ScenarioManager must always reference a particular model (given by the namespace). The control methods start, stop, pause, resume operate on this particular model.


Method Summary
 void clearListeners()
          Removes all listeners.
 SimulationID[] getInstances()
          Gets the simulation ids of the simulations instances currently running for the model.
 ModelState getModelState(SimulationID uid)
          Returns the current state of a simulation.
 void pause()
          Pauses the model run by pausing all simulation instances.
 void registerSimulationListener(ScenarioListener listener)
          Registers a listener.
 void resume()
          Resumes a model run by resuming all simulation instances.
 void shutdown()
          Shuts down a model run and all its simulations.
 void start()
          Starts a model run by starting all simulation instances.
 void unregisterSimulationListener(ScenarioListener listener)
          Removes a single listener.
 

Method Detail

start

void start()
           throws GSimException
Starts a model run by starting all simulation instances.

Throws:
GSimException

clearListeners

void clearListeners()
                    throws GSimException
Removes all listeners.

Throws:
GSimException

getInstances

SimulationID[] getInstances()
                            throws GSimException
Gets the simulation ids of the simulations instances currently running for the model.

Returns:
List of SimulationID
Throws:
GSimException

getModelState

ModelState getModelState(SimulationID uid)
                         throws GSimException
Returns the current state of a simulation.

Parameters:
uid - id of the simulation
Returns:
ModelState an object containing information about the current state of the model
Throws:
GSimException

pause

void pause()
           throws GSimException
Pauses the model run by pausing all simulation instances.

Throws:
GSimException

registerSimulationListener

void registerSimulationListener(ScenarioListener listener)
                                throws GSimException
Registers a listener. The ScenarioManager informs listeners about events such as the end of a simulation.

Parameters:
listener - the listener
Throws:
GSimException

resume

void resume()
            throws GSimException
Resumes a model run by resuming all simulation instances.

Throws:
GSimException

shutdown

void shutdown()
              throws GSimException
Shuts down a model run and all its simulations.

Throws:
GSimException

unregisterSimulationListener

void unregisterSimulationListener(ScenarioListener listener)
                                  throws GSimException
Removes a single listener.

Parameters:
listener - the listener
Throws:
GSimException