org.mars_sim.msp.core.events
Class HistoricalEventManager

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

public class HistoricalEventManager
extends Object

This class provides a manager that maintains a model of the events that have occurred 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 decreasing 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 String MALFUNCTION
           
static String MEDICAL
           
static String MISSION
           
static String TASK
           
static String TRANSPORT
           
 
Constructor Summary
HistoricalEventManager()
          Create a new EventManager that represents a particular simulation.
 
Method Summary
 void addListener(HistoricalEventListener newListener)
          Add a historical event listener
 void destroy()
          Prepare object for garbage collection.
 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 String MEDICAL
See Also:
Constant Field Values

MALFUNCTION

public static final String MALFUNCTION
See Also:
Constant Field Values

MISSION

public static final String MISSION
See Also:
Constant Field Values

TASK

public static final String TASK
See Also:
Constant Field Values

TRANSPORT

public static final String TRANSPORT
See Also:
Constant Field Values
Constructor Detail

HistoricalEventManager

public HistoricalEventManager()
Create a new EventManager that represents 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 time stamped 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 event count.

destroy

public void destroy()
Prepare object for garbage collection.



Copyright © 2009-2013. All Rights Reserved.