cz.cuni.amis.pogamut.base.communication.worldview.react
Class EventReactOnce<EVENT extends IWorldEvent>
java.lang.Object
cz.cuni.amis.pogamut.base.communication.worldview.react.EventReact<EVENT>
cz.cuni.amis.pogamut.base.communication.worldview.react.EventReactOnce<EVENT>
- Type Parameters:
EVENT -
public abstract class EventReactOnce<EVENT extends IWorldEvent>
- extends EventReact<EVENT>
This abstract class allows you to easily hook a specific event-handling behavior. It automatically
register a listener for a specified IWorldEvent for you and calls EventReact.react(IWorldEvent)
method automatically. The EventReact.react(IWorldEvent) will be called only once (upon first event received).
If you need to react every time, use EventReact.
Use EventReact.enable() and EventReact.disable() to enable react / disable react. The reaction is enabled
as default.
WARNING:Use as anonymous class, but save it as a field of your class! Note, that we're using weak-references to
listeners and if you do not save pointer to the object, it will be gc()ed!
- Author:
- Jimmy
|
Method Summary |
protected void |
postReact(EVENT event)
Disables the reaction. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EventReactOnce
public EventReactOnce(Class<EVENT> eventClass,
IWorldView worldView)
postReact
protected void postReact(EVENT event)
- Disables the reaction.
- Overrides:
postReact in class EventReact<EVENT extends IWorldEvent>
Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.