lime
Class LocalizedReaction

java.lang.Object
  |
  +--lime.Reaction
        |
        +--lime.LocalizedReaction
All Implemented Interfaces:
java.io.Serializable

public class LocalizedReaction
extends Reaction

Specifies reactions that are concerned only with a localized projection of the shared tuple space. The projection is defined using a pair current/destination location, similar to other tuple space operations such as inp. Basically, in order for the reaction to fire, not only the tuple space must contain a tuple that matches the template specified by the reaction, but the current and destination locations of the tuple must match as well.

ts.addReaction(new LocalizedReaction(new HostLocation(
new LimeServerID(InetAddress.getLocalHost(),
agent.getMgr().getPort())),
new AgentLocation(agent.getMgr().getID()),
new MyReactionListener(),
template, Reaction.ONCE);
that specifies a reaction whose current location is bound to the host where the statement is executed, by determining the local host, e.g., myHost.

The UNSPECIFIED wild card location is allowed only for the destination location. If UNSPECIFIED is passed as the current parameter, an exception is raised in the constructor of LocalizedReaction. NOTE: These semantics have changed since the original release.

Version:
1.0 alpha
Author:
Amy L. Murphy, Gian Pietro Picco
See Also:
Reaction, UbiquitousReaction, ReactionListener, LimeTupleSpace, Serialized Form

Fields inherited from class lime.Reaction
ONCE, ONCEPERTUPLE
 
Constructor Summary
LocalizedReaction(Location current, AgentLocation destination, lights.interfaces.ITuple template, ReactionListener listener, short mode)
          Create the reaction, by specifying location information.
 
Methods inherited from class lime.Reaction
getCurrentLocation, getDestinationLocation, getListener, getMode, getTemplate, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocalizedReaction

public LocalizedReaction(Location current,
                         AgentLocation destination,
                         lights.interfaces.ITuple template,
                         ReactionListener listener,
                         short mode)
                  throws java.lang.IllegalArgumentException
Create the reaction, by specifying location information.
Parameters:
current - the current location of tuples that are considered when evaluating this reaction. Must not be UNSPECIFIED
destination - the destination location of tuples considered when evaluating this reaction.
template - tuples in the shared tuple space that match this template will trigger execution of the reaction, i.e., invocation of the listener.
listener - the reaction listener, which specifies the computation to take place when the reaction is fired.
mode - the reaction mode (see Reaction).