cz.cuni.amis.pogamut.base.agent.impl
Class AgentId

Package class diagram package AgentId
java.lang.Object
  extended by cz.cuni.amis.pogamut.base.agent.impl.AgentId
All Implemented Interfaces:
IAgentId, cz.cuni.amis.utils.token.IToken, Serializable
Direct Known Subclasses:
AgentTeamedId, TeamedAgentId

public class AgentId
extends Object
implements IAgentId

Default AgentId providing unique id based on UID and IP of the host.

Author:
Jimmy
See Also:
Serialized Form

Field Summary
static String AGENT_NAME_DEPENDENCY
           
static String NO_NAME
           
protected static Random random
           
 
Constructor Summary
AgentId()
           
AgentId(String agentName)
           
 
Method Summary
 boolean equals(Object obj)
           
 long[] getIds()
           
 cz.cuni.amis.utils.flag.Flag<String> getName()
          Contains a human-readable name of the agent.
 String getToken()
          Must return token that is unique even across different JVMs.
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

AGENT_NAME_DEPENDENCY

public static final String AGENT_NAME_DEPENDENCY
See Also:
Constant Field Values

random

protected static Random random

NO_NAME

public static final String NO_NAME
See Also:
Constant Field Values
Constructor Detail

AgentId

public AgentId()

AgentId

@Inject
public AgentId(String agentName)
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getName

public cz.cuni.amis.utils.flag.Flag<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 cz.cuni.amis.utils.token.IToken

getToken

public 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 cz.cuni.amis.utils.token.IToken
Returns:
token

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2014 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.