Implementation: Event Manager

iGesture has an event manager providing an alternative method to react on recognised gestures in addition to the result set returned by the algorithm. Listeners can be added to an instance of an algorithm and an event manager is notified after each recognition process as shown in Figure 5 .


Figure 5: EventManager class diagram

An event manager has advantages compared to the processing of result sets by the caller in terms of executing different actions based on the result. Thereby, it is not necessary to implement different behaviour for various results on the client side which reduces code complexity.

After a notification has been triggered by an algorithm the event manager looks up in the event table if the recognised gesture is bound to an action. If so, the action is executed by the event manager.

Actions have to implement the EventHandler interface demanding for a run method with a ResultSet as parameter.

To be more flexible, the event manager contains instantiated objects. This has the advantage that the implementation of an event can be constructed with arbitrary parameters and therefore it is able to operate on all application data.

By definition, the algorithm has to notify the event manager after each call of the recognise method.