Package jade.core
Class ContainerID
- java.lang.Object
-
- jade.core.ContainerID
-
- All Implemented Interfaces:
Concept,Term,Location,Serializable,Serializable
public class ContainerID extends Object implements Location
A class identifying an aget container in the JADE platform. This class is a simple descriptor of JADE containers, holding their name and a few other data about them.- Author:
- Giovanni Rimassa - Universita' di Parma
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_IMTPString constant identifying the JADE default Internal Message Transport Protocol, connecting different containers within the same JADE platform.
-
Constructor Summary
Constructors Constructor Description ContainerID()The default costructor builds an uninitialized container ID.ContainerID(String n, TransportAddress a)Build a container ID with the given container name and transport address.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Equality operation over container IDs.StringgetAddress()Retrieve the IP address of the host, the described container is running on.StringgetID()Retrieve a string identifying the described container.BooleangetMain()StringgetName()Retrieve the name of the described container.StringgetPort()StringgetProtocol()Retrieves the IMTP protocol used to reach the described container.inthashCode()Hash code operation, compliant with identity-by-name.voidsetAddress(String a)Set the IP address (as a string) of the host, the described container is running on.voidsetMain(Boolean main)voidsetName(String n)Set the name of the described container.voidsetPort(String port)voidsetProtocol(String p)Set the IMTP protocol used to reach the described container.StringtoString()Retrieve a string representation for this container ID.
-
-
-
Field Detail
-
DEFAULT_IMTP
public static final String DEFAULT_IMTP
String constant identifying the JADE default Internal Message Transport Protocol, connecting different containers within the same JADE platform.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ContainerID
public ContainerID()
The default costructor builds an uninitialized container ID.
-
ContainerID
public ContainerID(String n, TransportAddress a)
Build a container ID with the given container name and transport address.- Parameters:
n- The name of the described container.a- The network address of the node where the described container is deployed.
-
-
Method Detail
-
setName
public void setName(String n)
Set the name of the described container.- Parameters:
n- The name to give to the described container.
-
getName
public String getName()
Retrieve the name of the described container.
-
setProtocol
public void setProtocol(String p)
Set the IMTP protocol used to reach the described container.- Parameters:
p- The name of the chosen IMTP protocol.
-
getProtocol
public String getProtocol()
Retrieves the IMTP protocol used to reach the described container.- Specified by:
getProtocolin interfaceLocation- Returns:
- The name of the IMTP protocol used in the described container.
-
setAddress
public void setAddress(String a)
Set the IP address (as a string) of the host, the described container is running on.- Parameters:
a- The string representation of the IP address of the host, the described container is running on.
-
getAddress
public String getAddress()
Retrieve the IP address of the host, the described container is running on.- Specified by:
getAddressin interfaceLocation- Returns:
- The string representation of the IP address of the host, the described container is running on.
-
getPort
public String getPort()
-
setPort
public void setPort(String port)
-
getID
public String getID()
Retrieve a string identifying the described container. The string is composed by the container name, the @ symbol and the transport URL string.
-
toString
public String toString()
Retrieve a string representation for this container ID. The string returned is the ID string of the described container.
-
equals
public boolean equals(Object obj)
Equality operation over container IDs. TwoContainerIDobjects are considered equal if and only if their name is the same (a case insensitive string comparison is used.- Overrides:
equalsin classObject- Parameters:
obje- The right hand side of the equality operation, the left hand side being the current object.- Returns:
- If the
objparameter is an instance ofContainerIDclass and has the same name (case insensitively) as the current object, thentrueis returned. Otherwise, this method returnsfalse.
-
hashCode
public int hashCode()
Hash code operation, compliant with identity-by-name. This method returns an hash code for a container ID, so that two container IDs with the same name (case insensitively) have the same hash code.
-
setMain
public void setMain(Boolean main)
-
getMain
public Boolean getMain()
-
-