JADE_SL
Class AID

java.lang.Object
  extended byJADE_SL.AID
Direct Known Subclasses:
OntoAID

public class AID
extends java.lang.Object

This class represents a JADE Agent Identifier. JADE internal agent tables use this class to record agent names and addresses.


Field Summary
private  java.util.List addresses
           
private static java.lang.String atHAP
          private variable containing the right part of a local name
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  java.lang.String name
           
private  java.util.List resolvers
           
private  java.util.Properties userDefSlots
           
 
Constructor Summary
AID()
          Constructs an Agent-Identifier whose slot name is set to an empty string
AID(java.lang.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(java.lang.String name, boolean isGUID)
          Constructor for an Agent-identifier
 
Method Summary
 void addAddresses(java.lang.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(java.lang.String key, java.lang.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.
 java.lang.Object clone()
          Clone the AID object.
 int compareTo(java.lang.Object o)
          Comparison operation.
 boolean equals(java.lang.Object o)
          Equality operation.
 java.lang.String[] getAddressesArray()
          Returns an array of string containing all the addresses of the agent
 java.util.Iterator getAllAddresses()
          Returns an iterator of all the addresses of the agent.
 java.util.Iterator getAllResolvers()
          Returns an iterator of all the resolvers.
 java.util.Properties getAllUserDefinedSlot()
          Returns the user-defined slots as properties.
(package private)  java.lang.String getHap()
          Returns the HAP of the agent.
 java.lang.String getLocalName()
          Returns the local name of the agent (without the HAP).
 java.lang.String getName()
          This method returns the name of the agent.
 AID[] getResolversArray()
          Returns an array containing all the AIDs of the resolvers.
 int hashCode()
          Hash code.
 boolean removeAddresses(java.lang.String url)
          To remove a transport address.
 boolean removeResolvers(AID aid)
          To remove a resolver.
 void setLocalName(java.lang.String n)
          This method permits to set the symbolic name of an agent.
 void setName(java.lang.String n)
          This method permits to set the symbolic name of an agent.
 java.lang.String toString()
           
 void toText(java.io.Writer w)
          Deprecated. replaced by the method toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

private java.lang.String name

addresses

private java.util.List addresses

resolvers

private java.util.List resolvers

userDefSlots

private java.util.Properties userDefSlots

ISGUID

public static final boolean ISGUID
constant to be used in the constructor of the AID

See Also:
Constant Field Values

ISLOCALNAME

public static final boolean ISLOCALNAME
constant to be used in the constructor of the AID

See Also:
Constant Field Values

atHAP

private static java.lang.String atHAP
private variable containing the right part of a local name

Constructor Detail

AID

public AID()
Constructs an Agent-Identifier whose slot name is set to an empty string


AID

public AID(java.lang.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").

Constructor for an Agent-identifier This constructor (which is deprecated), examines the name to see if the "@" chararcter is present. If so, it calls this(name, ISGUID) otherwise it calls this(name, ISLOCALNAME) This ensures better compatibility with JADE2.2 code.

Parameters:
guid - is the Globally Unique identifer for the agent. The slot name assumes that value in the constructed object.
See Also:
AID(String boolean)

AID

public AID(java.lang.String name,
           boolean isGUID)
Constructor for an Agent-identifier

Parameters:
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 "@".
Method Detail

setName

public void setName(java.lang.String n)
This method permits to set the symbolic name of an agent. The passed parameter must be a GUID and not a local name.


setLocalName

public void setLocalName(java.lang.String n)
This method permits to set the symbolic name of an agent. The passed parameter must be a local name.


getName

public java.lang.String getName()
This method returns the name of the agent.


addAddresses

public void addAddresses(java.lang.String url)
This method permits to add a transport address where the agent can be contacted. The address is added only if not yet present


removeAddresses

public boolean removeAddresses(java.lang.String url)
To remove a transport address.

Parameters:
url - the address to remove
Returns:
true if the addres has been found and removed, false otherwise.

clearAllAddresses

public void clearAllAddresses()
To remove all addresses of the agent


getAllAddresses

public java.util.Iterator getAllAddresses()
Returns an iterator of all the addresses of the agent.

See Also:
jade.util.leap.Iterator

addResolvers

public 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)


removeResolvers

public boolean removeResolvers(AID aid)
To remove a resolver.

Parameters:
aid - the AID of the resolver to remove
Returns:
true if the resolver has been found and removed, false otherwise.

clearAllResolvers

public void clearAllResolvers()
To remove all resolvers.


getAllResolvers

public java.util.Iterator getAllResolvers()
Returns an iterator of all the resolvers.

See Also:
jade.util.leap.Iterator

addUserDefinedSlot

public void addUserDefinedSlot(java.lang.String key,
                               java.lang.String value)
To add a user defined slot (a pair key, value).

Parameters:
key - the name of the property
value - the corresponding value of the property

getAddressesArray

public java.lang.String[] getAddressesArray()
Returns an array of string containing all the addresses of the agent


getResolversArray

public AID[] getResolversArray()
Returns an array containing all the AIDs of the resolvers.


getAllUserDefinedSlot

public java.util.Properties getAllUserDefinedSlot()
Returns the user-defined slots as properties.

Returns:
all the user-defined slots as a jade.util.leap.Properties java Object.
See Also:
jade.util.leap.Properties

toString

public java.lang.String toString()
Returns:
the String full representation of this AID

toText

public void toText(java.io.Writer w)
Deprecated. replaced by the method toString

This method is called from ACLMessage in order to create the String encoding of an ACLMessage.


clone

public java.lang.Object clone()
Clone the AID object.


equals

public boolean equals(java.lang.Object o)
Equality operation. This method compares an AID object with another or with a Java String. The comparison is case insensitive.

Parameters:
o - The Java object to compare this AID to.
Returns:
true if one of the following holds:
  • The argument o is an AID object with the same GUID in its name slot (apart from differences in case).
  • The argument o is a String that is equal to the GUID contained in the name slot of this Agent ID (apart from differences in case).

compareTo

public int compareTo(java.lang.Object o)
Comparison operation. This operation imposes a total order relationship over Agent IDs.

Parameters:
o - Another AID object, that will be compared with the current AID.
Returns:
-1, 0 or 1 according to the lexicographical order of the GUID of the two agent IDs, apart from differences in case.

hashCode

public int hashCode()
Hash code. This method returns an hash code in such a way that two AID objects with equal names or with names differing only in case have the same hash code.

Returns:
The hash code for this AID object.

getLocalName

public java.lang.String getLocalName()
Returns the local name of the agent (without the HAP). If the agent is not local, then the method returns its GUID.


getHap

java.lang.String getHap()
Returns the HAP of the agent.



Copyright © 2000-2003 BT Exact Technologies. All Rights Reserved.