cz.cuni.amis.pogamut.base.agent.impl
Class AgentId
java.lang.Object
cz.cuni.amis.pogamut.base.agent.impl.AgentId
- All Implemented Interfaces:
- IAgentId, IToken, java.io.Serializable
- Direct Known Subclasses:
- AgentTeamedId, TeamedAgentId
public class AgentId
- extends java.lang.Object
- implements IAgentId
Default AgentId providing unique id based on UID
and IP of the host.
- See Also:
- Serialized Form
Method Summary |
boolean |
equals(java.lang.Object obj)
|
long[] |
getIds()
|
Flag<java.lang.String> |
getName()
Contains a human-readable name of the agent. |
java.lang.String |
getToken()
Must return token that is unique even across different JVMs. |
int |
hashCode()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
AGENT_NAME_DEPENDENCY
public static final java.lang.String AGENT_NAME_DEPENDENCY
- See Also:
- Constant Field Values
random
protected static java.util.Random random
NO_NAME
public static final java.lang.String NO_NAME
- See Also:
- Constant Field Values
AgentId
public AgentId()
AgentId
@Inject
public AgentId(java.lang.String agentName)
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in class java.lang.Object
getName
public Flag<java.lang.String> getName()
- Description copied from interface:
IAgentId
- Contains a human-readable name of the agent.
Note that the name is quite different string than IAgentId.getToken()
. The
token contains unique-identifier of the agent across whole JVMs in the world, but
the name is just human-readable identifier that can be even changed over time.
Therefore, the name should not be used for any compares or interpretation.
- Specified by:
getName
in interface IAgentId
- Returns:
getIds
public long[] getIds()
- Specified by:
getIds
in interface IToken
getToken
public java.lang.String getToken()
- Description copied from interface:
IAgentId
- Must return token that is unique even across different JVMs.
- Specified by:
getToken
in interface IAgentId
- Specified by:
getToken
in interface IToken
- Returns:
- token
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object