org.jgap.event
Class EventManager
- java.lang.Object
-
- 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
Constructors Constructor and Description EventManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddEventListener(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.Objectclone()voidfireGeneticEvent(GeneticEvent a_eventToFire)Fires a genetic event.inthashCode()voidremoveEventListener(java.lang.String a_eventName, GeneticEventListener a_eventListenerToRemove)Removes the given listener from subscription of the indicated event.
-
-
-
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:
addEventListenerin interfaceIEventManager- 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 classa_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:
removeEventListenerin interfaceIEventManager- 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 classa_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:
fireGeneticEventin interfaceIEventManager- Parameters:
a_eventToFire- the representation of the genetic event to fire- Since:
- 1.0
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashcode
- Since:
- 3.0
-
clone
public java.lang.Object clone()
- Specified by:
clonein interfaceICloneable- Overrides:
clonein classjava.lang.Object- Returns:
- cloned instance
- Since:
- 3.2
-
-
DMelt 3.0 © DataMelt by jWork.ORG