org.mars_sim.msp.simulation.events
Class HistoricalEventManager

java.lang.Object
  extended by org.mars_sim.msp.simulation.events.HistoricalEventManager

public class HistoricalEventManager
extends java.lang.Object

This class provides a manager that maintains a model of the events that have occured during the current simulation run. It provides support for a listener pattern so the external objects can be notified when new events have been registered. The manager maintains an ordered list in terms of descreasing time, i.e. most recent event first. It should be noted that the throughput of new events of the manager can be in the order of 100 event per simulation tick.


Field Summary
static java.lang.String MALFUNCTION
           
static java.lang.String MEDICAL
           
static java.lang.String MISSION
           
static java.lang.String SUPPLY
           
static java.lang.String TASK
           
 
Constructor Summary
HistoricalEventManager()
          Create a new EventManager that represnets a particular simulation.
 
Method Summary
 void addListener(HistoricalEventListener newListener)
          Add a historical event listener
 HistoricalEvent getEvent(int index)
          Get the event at a specified index.
 void registerNewEvent(HistoricalEvent newEvent)
          An new event needs registering with the manager.
 void removeListener(HistoricalEventListener oldListener)
          Removes a historical event listener.
 int size()
          Get the number of events in the manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MEDICAL

public static final java.lang.String MEDICAL
See Also:
Constant Field Values

MALFUNCTION

public static final java.lang.String MALFUNCTION
See Also:
Constant Field Values

MISSION

public static final java.lang.String MISSION
See Also:
Constant Field Values

TASK

public static final java.lang.String TASK
See Also:
Constant Field Values

SUPPLY

public static final java.lang.String SUPPLY
See Also:
Constant Field Values
Constructor Detail

HistoricalEventManager

public HistoricalEventManager()
Create a new EventManager that represnets a particular simulation.

Method Detail

addListener

public void addListener(HistoricalEventListener newListener)
Add a historical event listener

Parameters:
newListener - listener to add.

removeListener

public void removeListener(HistoricalEventListener oldListener)
Removes a historical event listener.

Parameters:
oldListener - listener to remove.

getEvent

public HistoricalEvent getEvent(int index)
Get the event at a specified index.

Parameters:
index - Index of event to retrieve.
Returns:
Historical event.

registerNewEvent

public void registerNewEvent(HistoricalEvent newEvent)
An new event needs registering with the manager. The event will be timestamped with the current clock time and inserted at position zero.

Parameters:
newEvent - The event to register.

size

public int size()
Get the number of events in the manager.

Returns:
Stored evnet count.