com.speckled.specksim
Class SimulationEvent

java.lang.Object
  extended by com.speckled.specksim.SimulationEvent

public abstract class SimulationEvent
extends java.lang.Object

An event in the simulation. Any action that takes place at a specific time in the simulation must happen in an event

Author:
ryanm

Field Summary
 Speck owner
          The owner of this event.
 
Constructor Summary
SimulationEvent(Speck owner)
          Constructs a new Event.
 
Method Summary
abstract  void doEvent()
          Should be overridden with code that runs your event.
 float eventTime()
          Gets the time at which the event should happen.
 void setEventTime(float time)
          Sets the time at which this event should execute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

owner

public final Speck owner
The owner of this event. Allows us to easily remove all events owned by a particular speck from the queue.

Constructor Detail

SimulationEvent

public SimulationEvent(Speck owner)
Constructs a new Event.

Parameters:
owner - The owner of this event. Can be null.
Method Detail

eventTime

public float eventTime()
Gets the time at which the event should happen.

Returns:
The time, in simulated seconds, at which the event should happen.

setEventTime

public void setEventTime(float time)
Sets the time at which this event should execute

Parameters:
time - The target event time

doEvent

public abstract void doEvent()
Should be overridden with code that runs your event. Each event is removed from the queue before this method is called