JGAP

org.jgap.event
Class EventManager

java.lang.Object
  extended by org.jgap.event.EventManager
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, IEventManager, ICloneable

public class EventManager
extends java.lang.Object
implements IEventManager, ICloneable

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.

Since:
1.0
See Also:
Serialized Form

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.
 java.lang.Object clone()
           
 void fireGeneticEvent(GeneticEvent a_eventToFire)
          Fires a genetic event.
 int hashCode()
           
 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
equals, finalize, getClass, 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.

Specified by:
addEventListener in interface IEventManager
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
Since:
1.0

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.

Specified by:
removeEventListener in interface IEventManager
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
Since:
1.0

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.

Specified by:
fireGeneticEvent in interface IEventManager
Parameters:
a_eventToFire - the representation of the genetic event to fire
Since:
1.0

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
Returns:
hashcode
Since:
3.0

clone

public java.lang.Object clone()
Specified by:
clone in interface ICloneable
Overrides:
clone in class java.lang.Object
Returns:
cloned instance
Since:
3.2

JGAP