lime
Class ReactionEvent
java.lang.Object
java.util.EventObject
lime.ReactionEvent
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- MoteReactionEvent, SystemReactionEvent
- public class ReactionEvent
- extends java.util.EventObject
Contains information related to an event that may fire a reaction.
When an enabled reaction is selected for execution, i.e., its listener
is going to be executed (see ReactionListener
for details)
the information about the event that triggered the reaction is packed into
a ReactionEvent
object and passed to the
reactsTo
listener, which effectively embodies the reaction.
Currently, the only kind of event that can trigger a reaction is the
insertion (or, more in general, the presence) of a tuple in the shared
tuple space, although a more sophisticated event handling mechanism is
being considered.
- Version:
- 1.0 alpha
- Author:
- Amy L. Murphy, Gian Pietro Picco
- See Also:
ReactionListener
,
Reaction
,
Serialized Form
Fields inherited from class java.util.EventObject |
source |
Methods inherited from class java.util.EventObject |
getSource, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
eventTuple
lights.interfaces.ITuple eventTuple
reaction
RegisteredReaction reaction
ReactionEvent
protected ReactionEvent(AgentID source,
lights.interfaces.ITuple eventTuple,
RegisteredReaction reaction)
- Creates a new reaction event. (GP Note: this method is public in java.util,
but I believe this is not the case for us... )
- Parameters:
source
- the id of the agent owning the tuple space where the event
occurred.eventTuple
- the tuple that triggered the reaction.reaction
- the reaction this listener is part of. It is the same
object that has been passed at registration time.
getEventTuple
public LimeTuple getEventTuple()
- Get the tuple that triggered the reaction.
getReaction
public RegisteredReaction getReaction()
- Get the reaction this listener is associated with.
getSourceAgent
public AgentID getSourceAgent()
- Get the identifier of the agent owning the tuple space where the event
occurred.