|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object aigames.soccer.observer.Communication
The observer communication class.
Constructor Summary | |
Communication()
|
Method Summary | |
void |
chooseGame(java.lang.String name)
Chosing a game on the server to observe. |
void |
connect(java.lang.String ip,
int port)
Connect to a server. |
void |
disconnect()
Disconnect from a server. |
java.lang.String[] |
getGamesList()
Read a list of games. |
org.dom4j.Document |
readMessage(boolean confirm)
Read and parse a message from a socket. |
void |
run()
|
void |
sayHello(java.lang.String name)
Introduce the observer to a server. |
void |
setObserver(Observer observer)
Setter for observer object. |
void |
shutdown()
Stops the reading loop. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Communication()
Method Detail |
public void connect(java.lang.String ip, int port) throws java.lang.Exception
ip
- port
-
java.lang.Exception
- Thrown when connection fails.public void disconnect() throws java.lang.Exception
java.lang.Exception
- Thrown when disconnection fails.public void sayHello(java.lang.String name) throws java.lang.Exception
name
- observer name
java.lang.Exception
- Thrown when message acceptation read fails.public org.dom4j.Document readMessage(boolean confirm) throws java.lang.Exception
confirm
- if true the confirmation will be send
java.lang.Exception
- Thrown on read or parse error.public java.lang.String[] getGamesList()
public void chooseGame(java.lang.String name)
name
- of the gamepublic void setObserver(Observer observer)
observer
- public void shutdown()
public void run()
run
in interface java.lang.Runnable
Runnable.run()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |