org.jgap.event
Class EventManager

java.lang.Object
  extended byorg.jgap.event.EventManager

public class EventManager
extends java.lang.Object

Manages event notification in the system. Observers that desire to be notified of genetic events should subscribe to this class via the addEventListener() method. To unsubscribe, use the removeEventListener() method. To generate a genetic event, use the fireGeneticEvent() method, which will take care of notifying the appropriate subscribers.


Constructor Summary
EventManager()
           
 
Method Summary
 void addEventListener(java.lang.String a_eventName, GeneticEventListener a_eventListenerToAdd)
          Adds a new listener that will be notified when the event represented by the given name is fired.
 void fireGeneticEvent(GeneticEvent a_eventToFire)
          Fires a genetic event.
 void removeEventListener(java.lang.String a_eventName, GeneticEventListener a_eventListenerToRemove)
          Removes the given listener from subscription of the indicated event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventManager

public EventManager()
Method Detail

addEventListener

public void addEventListener(java.lang.String a_eventName,
                             GeneticEventListener a_eventListenerToAdd)
Adds a new listener that will be notified when the event represented by the given name is fired.

Parameters:
a_eventName - the name of the event to which the given listener should be subscribed. Standard events are represented by constants in the GeneticEvent class.
a_eventListenerToAdd - the genetic listener to subscribe to notifications of the given event.

removeEventListener

public void removeEventListener(java.lang.String a_eventName,
                                GeneticEventListener a_eventListenerToRemove)
Removes the given listener from subscription of the indicated event. The listener will no longer be notified when the given event occurs.

Parameters:
a_eventName - the name of the event to which the given listener should be removed. Standard events are represented by constants in the GeneticEvent class.
a_eventListenerToRemove - the genetic listener to unsubscribe from notifications of the given event.

fireGeneticEvent

public void fireGeneticEvent(GeneticEvent a_eventToFire)
Fires a genetic event. All subscribers of that particular event type (as determined by the name of the event) will be notified of it having been fired.

Parameters:
a_eventToFire - The representation of the GeneticEvent to fire.