sema
Class Engine

java.lang.Object
  extended bysema.Engine

public class Engine
extends java.lang.Object

Engine of the modelling. The current time is the one of the last treated event (t=0 at initialisation). It simulates a continious time (coded on a Double). An Event executes itself with no duration in the simulation. The lasting of a series of event is emulated by the virtual time to wait until next event.


Nested Class Summary
static class Engine.EndOfSimulation
          Indicates that the simulation has ended.
static class Engine.SimulationError
          The last event has raised an exception.
 
Constructor Summary
Engine()
           
 
Method Summary
protected  void add(Event ev)
          Add an event to the engine Events with strict inferior dates to the current simulated time, are ignored.
 void delete(Event ev)
          Delete an event from the engine.
 java.lang.String[][] getProperties()
          Returns the world's properties.
 double getTime()
          Returns the current simulated time in milliseconde
 void gotoDate(java.lang.Double date)
          Executes every events until it reachs the date.
 void next()
          Executes the events of the smallest date.
 void setProperties(java.lang.String property, java.lang.String value)
          Allows the modification of the properties through the interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Engine

public Engine()
Method Detail

getTime

public double getTime()
Returns the current simulated time in milliseconde


add

protected void add(Event ev)
Add an event to the engine Events with strict inferior dates to the current simulated time, are ignored.


delete

public void delete(Event ev)
Delete an event from the engine.


next

public void next()
          throws Engine.EndOfSimulation,
                 Engine.SimulationError
Executes the events of the smallest date.

Throws:
Engine.EndOfSimulation
Engine.SimulationError

gotoDate

public void gotoDate(java.lang.Double date)
              throws Engine.EndOfSimulation,
                     Engine.SimulationError
Executes every events until it reachs the date.

Throws:
Engine.EndOfSimulation
Engine.SimulationError

getProperties

public java.lang.String[][] getProperties()
Returns the world's properties. The properties are formated as a table with two columns, the first with the name of the property and the second with the value corresponding : ( everything must be of string type ) {{"prop1", "value1"}, ..., {"propN", "valueN"}}.


setProperties

public void setProperties(java.lang.String property,
                          java.lang.String value)
Allows the modification of the properties through the interface.
It takes the name of the property and the value (as a string) we want to associated to it. It changes it if it decides it but no waranties are made. The name of the property must be the same as the one returned by getProperties().