de.cesr.lara.toolbox.adapter.rs
Class LAbstractRsModel<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>,C>

java.lang.Object
  extended by de.cesr.lara.components.model.impl.LAbstractModel
      extended by de.cesr.lara.toolbox.adapter.rs.LAbstractRsModel<A,BO,C>
Type Parameters:
A - Agent class
BO - BO class
C - Type the root context is suitable for (mostly Object)
All Implemented Interfaces:
LaraAbstractEventSubscriber, LaraEventSubscriber, LaraInternalEventSubscriber, LaraModel, repast.simphony.dataLoader.ContextBuilder<C>
Direct Known Subclasses:
MyRsContextBuilder

public abstract class LAbstractRsModel<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>,C>
extends LAbstractModel
implements LaraEventSubscriber, repast.simphony.dataLoader.ContextBuilder<C>

For Repast Simphony Models, a context builder (a class implementing ContextBuilder builds up the model (at least its main context) and schedules actions. Therefore, the LAbstractRsModel serves as

Instructions: Call LEventbus.getInstance().publish(new LModelInstantiatedEvent()); in your ContextBuilder.build(repast.simphony.context.Context) method! NOTE: Your context creation class MUST implement ContextBuilder at its own (implementing the build(Context context) method) since Repast Simphony is not able (why so ever) to check whether super-classes extend/implement the interface!! NOTE: Do not call RunEnvironment.getInstance().getCurrentSchedule().schedule(this); in your subclass (otherwise, the stepping method is called more than one per tick)!


Field Summary
 
Fields inherited from class de.cesr.lara.components.model.impl.LAbstractModel
calendar, currentSimStage, eventBus, floatPointFormat, integerFormat, randomMan, step
 
Constructor Summary
LAbstractRsModel()
           
 
Method Summary
 void finish()
           
protected abstract  Iterable<? extends LaraAgent<A,BO>> getAgentIterable()
          Returns an object that may iterate over all agents.
protected  void initRsModel()
          This method should be called in your ContextBuilder.build(repast.simphony.context.Context)!
 void onInternalEvent(LaraEvent event)
          When overridden, needs to call super.onInternalEvent(event);!
 void stepIt()
          Anchor method for Repast Simphony to schedule the simulation.
 
Methods inherited from class de.cesr.lara.components.model.impl.LAbstractModel
advanceCalender, getCurrentDate, getCurrentSimulationStage, getCurrentStep, getFloatPointFormat, getIntegerFormat, getLRandom, init, setCurrentStep, step, step
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.cesr.lara.components.eventbus.LaraEventSubscriber
onEvent
 
Methods inherited from interface repast.simphony.dataLoader.ContextBuilder
build
 

Constructor Detail

LAbstractRsModel

public LAbstractRsModel()
Method Detail

onInternalEvent

public void onInternalEvent(LaraEvent event)
Description copied from class: LAbstractModel
When overridden, needs to call super.onInternalEvent(event);!

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

initRsModel

protected void initRsModel()
This method should be called in your ContextBuilder.build(repast.simphony.context.Context)! Schedules methods at RS schedule and publishes a LModelInstantiatedEvent. Sets consistent random seed. NOTE: Do not call RunEnvironment.getInstance().getCurrentSchedule().schedule(this); in your subclass (otherwise, the stepping method is called more than one per tick)!


stepIt

public void stepIt()
Anchor method for Repast Simphony to schedule the simulation.


finish

public void finish()

getAgentIterable

protected abstract Iterable<? extends LaraAgent<A,BO>> getAgentIterable()
Returns an object that may iterate over all agents.

Returns:
iterable over agents