|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbluegammon.logic.Player
bluegammon.logic.RemotePlayer
Represents a player that is on the other side of a connection; a remote player does not have access to this device.
This RemotePlayer
is also a PlayerListener
and
retreives events from a LocalPlayer
remotely sent from a
PlayerListenerProxy
via streams. It then deparses remote data
and calls appropriate action on the BoardMediator
.
Field Summary |
Fields inherited from interface bluegammon.logic.PlayerListener |
LOCAL_GIVE_UP, LOCAL_QUIT, REMOTE_GIVE_UP, REMOTE_QUIT |
Constructor Summary | |
RemotePlayer(int id,
char[] name,
boolean white,
java.io.DataInputStream in)
Creates a remote player. |
Method Summary | |
void |
gameExited(int id,
int reason)
Called when a game exit event is received. |
void |
messageSent(int id,
char[] msg)
Called when a message event is received. |
void |
moveMade(int id,
int moveIndex)
Called when a move made event is received. |
void |
run()
Runnable implementation, reading data from the input stream and deserializes the events. |
void |
turnCommit(int id)
Called when a turn commit event is received. |
void |
undoPerformed(int id)
Called when an undo performed event is received. |
Methods inherited from class bluegammon.logic.Player |
addListener, getId, getName, init, isWhite, setWhite |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RemotePlayer(int id, char[] name, boolean white, java.io.DataInputStream in)
id
- The id of the remote player.name
- The name of the remote player.white
- The color of the remote player, true for white, false for black.in
- The stream the remote player is reading events from.Method Detail |
public void moveMade(int id, int moveIndex)
moveMade
in interface PlayerListener
id
- Player id.moveIndex
- The moveindex in possible move array used for move.public void undoPerformed(int id)
undoPerformed
in interface PlayerListener
id
- Player id.public void turnCommit(int id)
turnCommit
in interface PlayerListener
id
- Player id.public void messageSent(int id, char[] msg)
messageSent
in interface PlayerListener
id
- Player id.msg
- The message.public void gameExited(int id, int reason)
gameExited
in interface PlayerListener
id
- Player id.reason
- The reason for exiting game.public void run()
run
in interface java.lang.Runnable
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |