public class AgentID extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<AgentID>
Constructor and Description |
---|
AgentID(AgentID aid,
Messenger owner)
Constructor to create an owned agent id from another agent id.
|
AgentID(java.lang.String name)
Constructor to create an agent id given the agent's name.
|
AgentID(java.lang.String name,
boolean isTopic)
Constructor to create an agent id for an agent or a topic.
|
AgentID(java.lang.String name,
boolean isTopic,
Messenger owner)
Constructor to create an owned agent id for an agent or a topic.
|
AgentID(java.lang.String name,
Messenger owner)
Constructor to create an owned agent id given the agent's name.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(AgentID aid)
Compares two agent ids to determine an ordering.
|
boolean |
equals(java.lang.Object obj)
Compares this agent id with another object.
|
java.lang.Object |
get(Parameter param)
Sends a parameter request to the agent represented by this id and
returns the parameter value from the agent, or null if unavailable.
|
java.lang.Object |
get(Parameter param,
int ndx)
Sends a parameter request to the agent represented by this id and
returns the parameter value from the agent, or null if unavailable.
|
java.lang.String |
getName()
Gets the name of the agent or topic.
|
Messenger |
getOwner()
Gets the owner of the agent id.
|
java.lang.String |
getType()
Gets the type of the agent, if available.
|
int |
hashCode()
Computes a hashcode for the agent id.
|
boolean |
isTopic()
Returns true if the agent id represents a topic.
|
Message |
request(Message msg)
Sends a request to the agent represented by this id and waits for
a return message for 1 second.
|
Message |
request(Message msg,
long timeout)
Sends a request to the agent represented by this id and waits for
a return message for a specified timeout.
|
void |
send(Message msg)
Sends a message to the agent represented by this id.
|
java.lang.Object |
set(Parameter param,
java.lang.Object value)
Sends a parameter request to the agent represented by this id to
change the parameter value from the agent.
|
java.lang.Object |
set(Parameter param,
java.lang.Object value,
int ndx)
Sends a parameter request to the agent represented by this id to
change the parameter value from the agent.
|
void |
setType(java.lang.String type)
Sets the type of the agent.
|
java.lang.String |
toString()
Gets a string representation of the agent id.
|
public AgentID(java.lang.String name)
name
- name of the agent.public AgentID(java.lang.String name, boolean isTopic)
name
- name of the agent or topic.isTopic
- true if the agent id is to represent a topic,
false if it is to represent an agent.public AgentID(java.lang.String name, Messenger owner)
name
- name of the agent.owner
- owner agent.public AgentID(java.lang.String name, boolean isTopic, Messenger owner)
name
- name of the agent or topic.isTopic
- true if the agent id is to represent a topic,
false if it is to represent an agent.owner
- owner agent.public boolean isTopic()
public java.lang.String getName()
public Messenger getOwner()
public java.lang.String getType()
public void setType(java.lang.String type)
type
- type of the agent.public void send(Message msg)
msg
- message to send.public Message request(Message msg)
msg
- request to send.public Message request(Message msg, long timeout)
msg
- request to send.timeout
- timeout in milliseconds.public java.lang.Object get(Parameter param)
param
- parameter name or enum.public java.lang.Object get(Parameter param, int ndx)
param
- parameter name or enum.ndx
- index of parameter (-1 for non-indexed parameters).public java.lang.Object set(Parameter param, java.lang.Object value)
param
- parameter name or enum.value
- value of the parameter.public java.lang.Object set(Parameter param, java.lang.Object value, int ndx)
param
- parameter name or enum.value
- value of the parameter.ndx
- index of parameter (-1 for non-indexed parameters).public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public int compareTo(AgentID aid)
compareTo
in interface java.lang.Comparable<AgentID>
aid
- agent id to compare to.