lime
Class AgentLocation
java.lang.Object
|
+--lime.Location
|
+--lime.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
Constructor Summary |
AgentLocation(AgentID agentID)
Create a location corresponding to the ITS of a given agent. |
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 java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
UNSPECIFIED
public static final AgentLocation UNSPECIFIED
- Defines a wild card location that denotes an unspecified agent location.
AgentLocation
public AgentLocation(AgentID agentID)
- Create a location corresponding to the ITS of a given agent.
- Parameters:
agentID
- the agent identifier.
equals
public boolean equals(java.lang.Object l)
- Tests two agent locations for equality.
- Overrides:
equals
in class java.lang.Object
- 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.
- Overrides:
toString
in class java.lang.Object