public class AID extends Object implements Comparable, Serializable
Modifier and Type | Field and Description |
---|---|
private List |
addresses |
static String |
AGENT_CLASSNAME
Key to retrieve the agent class name as a user defined slot of
the AID included in the AMSAgentDescription registered with
the AMS.
|
private static int |
EXPECTED_ADDRESSES_SIZE |
private static int |
EXPECTED_RESOLVERS_SIZE |
private int |
hashCode |
static boolean |
ISGUID
constant to be used in the constructor of the AID
|
static boolean |
ISLOCALNAME
constant to be used in the constructor of the AID
|
private String |
name |
private Long |
persistentID |
private static String |
platformID |
private List |
resolvers |
private Properties |
userDefSlots |
Constructor and Description |
---|
AID()
Constructs an Agent-Identifier whose slot name is set to an empty string
|
AID(String guid)
Deprecated.
This constructor might generate a wrong AID, if
the passed parameter is not a guid (globally unique identifier), but
the local name of an agent (e.g. "da0").
|
AID(String name,
boolean isGUID)
Constructor for an Agent-identifier
|
Modifier and Type | Method and Description |
---|---|
void |
addAddresses(String url)
This method permits to add a transport address where
the agent can be contacted.
|
void |
addResolvers(AID aid)
This method permits to add the AID of a resolver (an agent where name
resolution services for the agent can be contacted)
|
void |
addUserDefinedSlot(String key,
String value)
To add a user defined slot (a pair key, value).
|
void |
clearAllAddresses()
To remove all addresses of the agent
|
void |
clearAllResolvers()
To remove all resolvers.
|
Object |
clone()
Clone the AID object.
|
int |
compareTo(Object o)
Comparison operation.
|
boolean |
equals(Object o)
Equality operation.
|
String[] |
getAddressesArray()
Returns an array of string containing all the addresses of the agent
|
Iterator |
getAllAddresses()
Returns an iterator of all the addresses of the agent.
|
Iterator |
getAllResolvers()
Returns an iterator of all the resolvers.
|
Properties |
getAllUserDefinedSlot()
Returns the user-defined slots as properties.
|
String |
getHap()
Returns the HAP of the agent or null if the GUID of this
AID is not of the form |
String |
getLocalName()
Returns the local name of the agent (without the HAP).
|
String |
getName()
This method returns the name of the agent.
|
private Long |
getPersistentID() |
(package private) static String |
getPlatformID() |
AID[] |
getResolversArray()
Returns an array containing all the AIDs of the resolvers.
|
int |
hashCode()
Hash code.
|
boolean |
removeAddresses(String url)
To remove a transport address.
|
boolean |
removeResolvers(AID aid)
To remove a resolver.
|
boolean |
removeUserDefinedSlot(String key)
To remove a user defined slot.
|
private void |
setAddressesArray(String[] arr) |
void |
setLocalName(String n)
This method permits to set the symbolic name of an agent.
|
void |
setName(String n)
This method permits to set the symbolic name of an agent.
|
private void |
setPersistentID(Long l) |
(package private) static void |
setPlatformID(String id) |
private void |
setResolversArray(AID[] arr) |
String |
toString()
Converts this agent identifier into a readable string.
|
private static String platformID
private String name
private int hashCode
private static final int EXPECTED_ADDRESSES_SIZE
private static final int EXPECTED_RESOLVERS_SIZE
private List addresses
private List resolvers
private Properties userDefSlots
public static final boolean ISGUID
public static final boolean ISLOCALNAME
public static final String AGENT_CLASSNAME
private transient Long persistentID
public AID()
public AID(String guid)
this(name, ISGUID)
otherwise it calls this(name, ISLOCALNAME)
This ensures better compatibility with JADE2.2 code.
guid
- is the Globally Unique identifer for the agent. The slot name
assumes that value in the constructed object.AID(String boolean)
public AID(String name, boolean isGUID)
name
- is the value for the slot name for the agent.isGUID
- indicates if the passed name
is already a globally unique identifier or not. Two
constants ISGUID
, ISLOCALNAME
have also been defined for setting a value for this parameter.
If the name is a local name, then the HAP (Home Agent Platform)
is concatenated to the name, separated by "@".static final String getPlatformID()
static final void setPlatformID(String id)
public void setName(String n)
public void setLocalName(String n)
public String getName()
public void addAddresses(String url)
public boolean removeAddresses(String url)
url
- the address to removepublic void clearAllAddresses()
public Iterator getAllAddresses()
Iterator
public void addResolvers(AID aid)
public boolean removeResolvers(AID aid)
aid
- the AID of the resolver to removepublic void clearAllResolvers()
public Iterator getAllResolvers()
Iterator
public void addUserDefinedSlot(String key, String value)
key
- the name of the propertyvalue
- the corresponding value of the propertypublic boolean removeUserDefinedSlot(String key)
key
- the name of the propertypublic String[] getAddressesArray()
private void setAddressesArray(String[] arr)
public AID[] getResolversArray()
private void setResolversArray(AID[] arr)
public Properties getAllUserDefinedSlot()
jade.util.leap.Properties
java Object.Properties
public String toString()
public boolean equals(Object o)
AID
object with
another or with a Java String
. The comparison is case
insensitive.equals
in class Object
o
- The Java object to compare this AID
to.true
if one of the following holds:
o
is an AID
object
with the same GUID in its name slot (apart from
differences in case).
o
is a String
that is
equal to the GUID contained in the name slot of this
Agent ID (apart from differences in case).
public int compareTo(Object o)
compareTo
in interface Comparable
o
- Another AID
object, that will be compared
with the current AID
.public int hashCode()
AID
objects with equal names or with names differing
only in case have the same hash code.public String getLocalName()
public String getHap()
AID
is not of the form private Long getPersistentID()
private void setPersistentID(Long l)