lime
Class ReactionEvent

java.lang.Object
  extended byjava.util.EventObject
      extended bylime.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

Field Summary
(package private)  lights.interfaces.ITuple eventTuple
           
(package private)  RegisteredReaction reaction
           
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
protected ReactionEvent(AgentID source, lights.interfaces.ITuple eventTuple, RegisteredReaction reaction)
          Creates a new reaction event.
 
Method Summary
 LimeTuple getEventTuple()
          Get the tuple that triggered the reaction.
 RegisteredReaction getReaction()
          Get the reaction this listener is associated with.
 AgentID getSourceAgent()
          Get the identifier of the agent owning the tuple space where the event occurred.
 
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
 

Field Detail

eventTuple

lights.interfaces.ITuple eventTuple

reaction

RegisteredReaction reaction
Constructor Detail

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.
Method Detail

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.