de.cau.cs.kieler.sim.kiem.automated.extension
Class EventListener

java.lang.Object
  extended by de.cau.cs.kieler.sim.kiem.automated.extension.EventListener
All Implemented Interfaces:
IKiemEventListener

public class EventListener
extends Object
implements IKiemEventListener

The event listener listens to events coming from the KIEM that are related to the execution.

Rating proposed yellow
(2010-01-29)

Constructor Summary
EventListener()
           
 
Method Summary
 void notifyEvent(KiemEvent event)
          This is the basic notify method that is called by KIEM whenever an event occurs for which this EventListener is registered (see IKiemEventListener.provideEventOfInterest()).
 KiemEvent provideEventOfInterest()
           Return a KiemEvent type (integer value) that represents a number of events this component wants to listen to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventListener

public EventListener()
Method Detail

notifyEvent

public void notifyEvent(KiemEvent event)
This is the basic notify method that is called by KIEM whenever an event occurs for which this EventListener is registered (see IKiemEventListener.provideEventOfInterest()).

Specified by:
notifyEvent in interface IKiemEventListener
Parameters:
event - the KiemEvent with additional attached information, depending on the specific event

provideEventOfInterest

public KiemEvent provideEventOfInterest()

Return a KiemEvent type (integer value) that represents a number of events this component wants to listen to.

A KiemEvent can be a combination of several events. The simplest way to register for two events that e.g., indicate a step-command and the removal of the component is to have the following code:

public KiemEvent provideEventOfInterest() {
int[] events = {CMD_STEP, DELETED}
return new KiemEvent(events);
}

Specified by:
provideEventOfInterest in interface IKiemEventListener
Returns:
the KiemEvent type indicating the events of interest