|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.almende.eve.agent.Agent
com.almende.eve.agent.example.ChatAgent
public class ChatAgent
Constructor Summary | |
---|---|
ChatAgent()
|
Method Summary | |
---|---|
void |
connect(String url)
connect two agents with each other |
void |
disconnect()
Disconnect this agent from all other agents in the chat room |
List<String> |
getConnections()
Retrieve the urls of all agents that are connected |
String |
getDescription()
Retrieve a description of the agents functionality |
String |
getUsername()
Get the username |
String |
getVersion()
Retrieve the agents version number |
void |
post(String message)
Post a message to all registered agents (including itself). |
void |
receive(String url,
String username,
String message)
Receive a message from an agent |
void |
removeConnection(String url)
Remove an agent from connections list |
void |
setUsername(String username)
Set the username, used for displaying messages |
Methods inherited from class com.almende.eve.agent.Agent |
---|
clear, create, createAgentProxy, delete, destroy, finalize, getAgentFactory, getContext, getId, getMethods, getScheduler, getState, getType, getUrls, init, onSubscribe, onTrigger, onUnsubscribe, send, send, send, send, sendAsync, sendAsync, setAgentFactory, setState, subscribe, toString, trigger, unsubscribe, unsubscribe |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ChatAgent()
Method Detail |
---|
public String getUsername() throws Exception
Exception
public void setUsername(String username)
username
- public void post(String message) throws Exception
message
-
Exception
JSONException
IOException
RuntimeException
public void receive(String url, String username, String message) throws Exception
url
- username
- message
-
Exception
public void connect(String url) throws Exception
url
- Url of an ChatAgent
Exception
public void disconnect() throws Exception
Exception
public void removeConnection(String url) throws Exception
url
- Url of a connected ChatAgent
Exception
public List<String> getConnections()
public String getDescription()
AgentInterface
getDescription
in interface AgentInterface
getDescription
in class Agent
public String getVersion()
AgentInterface
getVersion
in interface AgentInterface
getVersion
in class Agent
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |