massim.framework
Interface Simulation

All Superinterfaces:
Component
All Known Implementing Classes:
AbstractGridSimulation, AbstractSimulation, DefaultSimulation, GraphSimulation, GridSimulation, GridSimulation, GridSimulation, GridSimulation, GridSimulation, ParallelizedRandomOrderSimulation, RoundRobinSimulation

public interface Simulation
extends Component

This interface defines some methods that must be provided by any simulation to be used in the MASSim framework.


Method Summary
 void configureSimulation(SimulationConfiguration config)
          This method will be automatically called as soon as the simulation is being configured.
 java.lang.String endSimulation()
          This method will be automatically called once when the simulation has been started and it is to end.
 AgentManager getAgentManager()
          Retrieve the AgentManager that will be used for agent creation by this simulation.
 SimulationState getSimulationState()
          This method will retrieve the whole simulation state.
 boolean isFinished()
          This method returns true iff the simulation is in a final state.
 void setAgentManager(AgentManager agentmanager)
           
 void startSimulation()
          This method will be automatically called when the simulation starts.
 void stepSimulation()
          This method will be automatically called when the simulation is supposed to do a simulation step.
 
Methods inherited from interface massim.framework.Component
start, stop
 

Method Detail

startSimulation

void startSimulation()
This method will be automatically called when the simulation starts. Simulation implementors are encouraged to override this method. They may or may not create and remove agents and even ask them to act. It is however recommended to do initialization here.


stepSimulation

void stepSimulation()
This method will be automatically called when the simulation is supposed to do a simulation step. Simulation implementors are encouraged to override this method. They may or may not create and remove agents and ask them to act.


endSimulation

java.lang.String endSimulation()
This method will be automatically called once when the simulation has been started and it is to end. It's not mandatory that startSimulation or stepSimulation returned false.


isFinished

boolean isFinished()
This method returns true iff the simulation is in a final state.

Returns:
true iff simulation is in final state

configureSimulation

void configureSimulation(SimulationConfiguration config)
This method will be automatically called as soon as the simulation is being configured. This method may only be called when the simulation is not running and must be called before the simulation will be started. Simulation implementors are encouraged to override this method.

Parameters:
config - configuration message

getSimulationState

SimulationState getSimulationState()
This method will retrieve the whole simulation state. In general this state object should contain any information about the simulation game state though this is not a requirement. So it's up to you what information is put here.

Returns:
the simulation state

getAgentManager

AgentManager getAgentManager()
Retrieve the AgentManager that will be used for agent creation by this simulation. Simulation implementors should not use getAgentManager and access it directly, but use the Agent object and createAgent instead.

Returns:
Returns the agentmanager.

setAgentManager

void setAgentManager(AgentManager agentmanager)
Parameters:
agentmanager - The agentmanager to set.


Copyright © 2011. All Rights Reserved.