de.cesr.lara.components.model.impl
Class LAbstractModel

java.lang.Object
  extended by de.cesr.lara.components.model.impl.LAbstractModel
All Implemented Interfaces:
LaraAbstractEventSubscriber, LaraInternalEventSubscriber, LaraModel
Direct Known Subclasses:
LAbstractRsModel, LAbstractStandaloneSynchronisedModel

public abstract class LAbstractModel
extends Object
implements LaraModel, LaraInternalEventSubscriber

Since this class does not deal with agents, certain methods regarding agents are abstract Features:

NOTE: The simulation state is only valid in case of synchronous agent triggering!


Field Summary
protected  Calendar calendar
          Calendar that tracks simulation step
protected  LSimulationStage currentSimStage
          The simulatsion's current stage
protected  LEventbus eventBus
           
protected  NumberFormat floatPointFormat
          NumberFormat to format floating point numbers
protected  NumberFormat integerFormat
          NumberFormat to format integer numbers
protected  LaraRandom randomMan
          The LaraRandom instance of this model
protected  int step
          current time step
 
Constructor Summary
LAbstractModel()
          Constructor.
 
Method Summary
 void advanceCalender()
          This method is called every time step.
 Date getCurrentDate()
          Returns the Date object for the date that is associated with the current tick.
 LSimulationStage getCurrentSimulationStage()
          Returns the current simulation stage, no matter if agents are triggered synchronously or asynchronously.
 int getCurrentStep()
          Retrieve the current overall time step.
 NumberFormat getFloatPointFormat()
          Returns a NumberFormat to format decimal floating point numbers
 NumberFormat getIntegerFormat()
          Returns a NumberFormat to format integer numbers
 LaraRandom getLRandom()
          Return the random manager that is used for random processes in LARA.
 void init()
          Methods that override this method must (except you know what you are doing) call super.init()!
 void onInternalEvent(LaraEvent event)
          When overridden, needs to call super.onInternalEvent(event);!
 void setCurrentStep(int step)
          Set the current overall time step.
 void step()
          Note: This method is alternative to step(int stepIncrease)
 void step(int stepIncrease)
          Note: This method is alternative to step
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

eventBus

protected LEventbus eventBus

calendar

protected Calendar calendar
Calendar that tracks simulation step


currentSimStage

protected LSimulationStage currentSimStage
The simulatsion's current stage


floatPointFormat

protected NumberFormat floatPointFormat
NumberFormat to format floating point numbers


integerFormat

protected NumberFormat integerFormat
NumberFormat to format integer numbers


randomMan

protected LaraRandom randomMan
The LaraRandom instance of this model


step

protected int step
current time step

Constructor Detail

LAbstractModel

public LAbstractModel()
Constructor. Registers for events at the event bus.

Method Detail

advanceCalender

public void advanceCalender()
This method is called every time step. Advances the calendar by one day. It should be overridden in case a tick means something other than a day.


init

public void init()
Methods that override this method must (except you know what you are doing) call super.init()! Triggered by ModelInstantiatedEvent.


onInternalEvent

public void onInternalEvent(LaraEvent event)
When overridden, needs to call super.onInternalEvent(event);!

Specified by:
onInternalEvent in interface LaraInternalEventSubscriber
See Also:
LaraInternalEventSubscriber.onInternalEvent(de.cesr.lara.components.eventbus.events.LaraEvent)

step

public final void step()
Note: This method is alternative to step(int stepIncrease)

Specified by:
step in interface LaraModel
See Also:
LaraModel.step()

step

public final void step(int stepIncrease)
Note: This method is alternative to step

Specified by:
step in interface LaraModel
Parameters:
stepIncrease - the number of steps to increase
See Also:
LaraModel.step(int)

getCurrentDate

public Date getCurrentDate()
Description copied from interface: LaraModel
Returns the Date object for the date that is associated with the current tick. Note that several ticks may be associated with the same Date.

Specified by:
getCurrentDate in interface LaraModel
Returns:
date the current date
See Also:
LaraModel.getCurrentDate()

getCurrentSimulationStage

public LSimulationStage getCurrentSimulationStage()
Description copied from interface: LaraModel
Returns the current simulation stage, no matter if agents are triggered synchronously or asynchronously.

Specified by:
getCurrentSimulationStage in interface LaraModel
Returns:
the current simulation stage
See Also:
LaraModel.getCurrentSimulationStage()

getCurrentStep

public int getCurrentStep()
Description copied from interface: LaraModel
Retrieve the current overall time step.

Specified by:
getCurrentStep in interface LaraModel
Returns:
step the current time step of the overall model
See Also:
LaraModel.getCurrentStep()

getFloatPointFormat

public NumberFormat getFloatPointFormat()
Description copied from interface: LaraModel
Returns a NumberFormat to format decimal floating point numbers

Specified by:
getFloatPointFormat in interface LaraModel
Returns:
A NumberFormat to format decimal floating point numbers
See Also:
LaraModel.getFloatPointFormat()

getIntegerFormat

public NumberFormat getIntegerFormat()
Description copied from interface: LaraModel
Returns a NumberFormat to format integer numbers

Specified by:
getIntegerFormat in interface LaraModel
Returns:
A NumberFormat to format integer numbers
See Also:
LaraModel.getIntegerFormat()

getLRandom

public LaraRandom getLRandom()
Description copied from interface: LaraModel
Return the random manager that is used for random processes in LARA. Either, the model author should implement (or assign to this.randomMan when extending AbstracLModel) the random number generator used in the custom model part, or reset the LRandomService by calling getLRandom.setSeed(seed) using the correct seed parameter. NOTE: Make sure that the LaraRandom class is instantiated only once since creating an instance every time this method is called results in starting the random sequence anew each time the method is called!

Specified by:
getLRandom in interface LaraModel
Returns:
the random manager
See Also:
LaraModel.getLRandom()

setCurrentStep

public void setCurrentStep(int step)
Description copied from interface: LaraModel
Set the current overall time step.

Specified by:
setCurrentStep in interface LaraModel
Parameters:
step - the current time step of the overall model
See Also:
LaraModel.setCurrentStep(int)