lime
Class AgentLocation

java.lang.Object
  extended bylime.Location
      extended bylime.AgentLocation
All Implemented Interfaces:
java.io.Serializable

public class AgentLocation
extends Location

Defines the location of a tuple with respect to an Agent.

In general AgentLocation is used for specifying the current and/or destination location when invoking location-dependent operations (see Location class). If the AgentLocation is used as the current field, the interface tuple space (ITS) of the agent is used. When an AgentLocation is used as the destination field, the tuples could be misplaced only if the agent is not present.

Similar to class HostLocation, it is possible to define an unspecified location using the wild card location constant AgentLocation.UNSPECIFIED. Then, for instance:

    ITuple t = ts.in(new HostLocation(new LimeServerID(InetAddress.getLocalHost()),
                                      LimeServer.getServer().getPort()),
                     AgentLocation.UNSPECIFIED,
                     template);
    
specifies a blocking in that looks for any tuple residing on the current host, independently from the tuple's final location.

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

Field Summary
(package private)  AgentID agentID
           
static AgentLocation UNSPECIFIED
          Defines a wild card location that denotes an unspecified agent location.
 
Fields inherited from class lime.Location
_ANY, _NORMAL, _UNKNOWN, _UNSPECIFIED, wildCard
 
Constructor Summary
  AgentLocation(AgentID agentID)
          Create a location corresponding to the ITS of a given agent.
(package private) AgentLocation(short wildCard)
          Create a wild card agent location, specified by one of the constants in the Location class.
 
Method Summary
 boolean equals(java.lang.Object l)
          Tests two agent locations for equality.
 java.lang.String toString()
          Returns a concise textual description for this object.
 
Methods inherited from class lime.Location
isWildCard
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

agentID

AgentID agentID

UNSPECIFIED

public static final AgentLocation UNSPECIFIED
Defines a wild card location that denotes an unspecified agent location.

Constructor Detail

AgentLocation

public AgentLocation(AgentID agentID)
Create a location corresponding to the ITS of a given agent.

Parameters:
agentID - the agent identifier.

AgentLocation

AgentLocation(short wildCard)
Create a wild card agent location, specified by one of the constants in the Location class.

Parameters:
wildCard - the constant specifying the wild card location.
Method Detail

equals

public boolean equals(java.lang.Object l)
Tests two agent locations for equality.

Parameters:
l - an agent location object (it can be a wild card location).
Returns:
if the locations being compared are not wild cards, true is returned if both locations correspond to the same agent. If the locations are wild cards, then true is returned if they correspond to the same constant (e.g, the method returns true when comparing two UNSPECIFIED locations). In all the remaining cases false is returned.

toString

public java.lang.String toString()
Returns a concise textual description for this object.