public class AgentAddress extends Object implements Serializable
How this class works is very different from the previous versions of MaDKit. More precisely, it now corresponds to a CGR location (community;group;role) where the agent is in. So, an agent may have several AgentAddress as it could join many CGR locations.
Moreover, if the related agent leaves the corresponding CGR location, then an
AgentAddress becomes invalid and no longer permits to reach this agent. For
instance, a message sent using
AbstractAgent.sendMessage(AgentAddress, Message) will not be
delivered if the agent has leaved the related CGR location.
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object agentAddress)
Tells if another address is the same.
|
String |
getAgentNetworkID()
Return a string representing a unique identifier of the binded agent over the
network.
|
String |
getCommunity()
Returns the community to which this agent address is binded to.
|
String |
getGroup()
Returns the group to which this agent address is binded to.
|
KernelAddress |
getKernelAddress() |
String |
getRole()
Returns the role to which this agent address is binded to.
|
String |
getSimpleAgentNetworkID()
Return a string representing a shorter version of the unique identifier of
the binded agent over the network.
|
int |
hashCode()
The hash code of an agent address.
|
boolean |
isFrom(KernelAddress kernel)
Tells if the address is from a specific kernel.
|
String |
toString()
Returns a string representing this address.
|
public KernelAddress getKernelAddress()
public String getCommunity()
public String getGroup()
public String getRole()
public String toString()
KernelAddress to which this address belongs to.public boolean equals(Object agentAddress) throws ClassCastException
true, this means that
both addresses refer to the same agent considering the same position in the
artificial society.equals in class ObjectagentAddress - the address to compare.ClassCastException - On purpose, if the address is compared to an
object with another type which is considered as a
programming error.public final int hashCode()
AbstractAgent.hashCode()public boolean isFrom(KernelAddress kernel)
true, This
means that the agent to which this address belongs to is located on the
tested kernel. So, it is just a shortcut for *
return getKernelAddress().equals(kernel);for which this address has been created was running on the local kernel.
kernel - the kernel address against which this address should be tested.true if this address belongs to the corresponding
kernel.public final String getAgentNetworkID()
public final String getSimpleAgentNetworkID()
AbstractAgent.getSimpleNetworkID()
Fabien Michel, Olivier Gutknecht, Jacques Ferber - November 30 2021