|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.moyoman.comm.client.Player
Any class which extends this class can be used by the PlayerManager class as one of the players in a game of Go. Some examples of these classes are a human user at the keyboard, the Moyoman back-end sever, and a player communicating through a socket using the GTP protocol.
Field Summary | |
protected Color |
color
The color of this player. |
private ArrayList |
endOfGameAl
Each object an ArrayList containing EndOfGameListener objects. |
protected Handicap |
handicap
The handicap for this game. |
private ArrayList |
makeMoveAl
Each object is an ArrayList containing MakeMoveListener objects. |
private ArrayList |
requestMoveAl
Each object is an ArrayList containing RequestMoveListener objects. |
Constructor Summary | |
Player(Color c,
Handicap h)
Create the Player object. |
Method Summary | |
abstract void |
derivedMakeMove(MoveDescriptor md)
Make a move. |
abstract MoveDescriptor |
derivedRequestMove()
Get a move from the player. |
private void |
endOfGameEventOccurred()
Send all EndOfGameListeners which are registered an EndOfGameEvent. |
Color |
getColor()
Get the color of the player. |
abstract GameRecord |
getGameRecord()
Get the game record for this player. |
Handicap |
getHandicap()
Get the handicap of the game. |
abstract String |
getId()
Return a String which is the game id. |
abstract String |
getIdentifyingInfo()
Return a String which identifies the player. |
abstract short |
getMoveNumber()
Get the move number. |
abstract boolean |
isSelfInitializingUser()
Return whether the player initializes itself on startup. |
abstract boolean |
isValidatedUser()
Return whether the player validates the legality of its moves. |
void |
makeMove(MoveDescriptor md)
Make a move. |
private void |
makeMoveEventOccurred(MoveDescriptor md)
Send all MakeMoveListeners which are registered a MakeMoveEvent. |
protected void |
makeMoveNoEvents(MoveDescriptor md)
Make a move without throwing any make move events. |
void |
registerEndOfGameMoveListener(EndOfGameListener eogl)
Add a EndOfGameMoveListener for end of game events on this Player. |
void |
registerMakeMoveListener(MakeMoveListener mml)
Add a MakeMoveListener for makeMove() calls on this Player. |
void |
registerRequestMoveListener(RequestMoveListener rml)
Add a RequestMoveListener for requestMove() calls on this Player. |
MoveDescriptor |
requestMove()
Get a move from the player. |
private void |
requestMoveEventOccurred(MoveDescriptor md)
Send all RequestMoveListeners which are registered a RequestMoveEvent. |
void |
unregisterEndOfGameListeners()
Remove all EndOfGameListeners for this player. |
void |
unregisterMakeMoveListeners()
Remove all MakeMoveListeners for this player. |
void |
unregisterRequestMoveListeners()
Remove all RequestMoveListeners for this player. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Color color
protected Handicap handicap
private ArrayList makeMoveAl
private ArrayList requestMoveAl
private ArrayList endOfGameAl
Constructor Detail |
public Player(Color c, Handicap h) throws InternalErrorException
c
- The color of the player.h
- The handicap for the game.
InternalErrorException
- - Thrown if an error
occurs while creating the player.Method Detail |
public final void makeMove(MoveDescriptor md) throws IllegalMoveException, InternalErrorException
md
- The MoveDescriptor which describes the move to make.
IllegalMoveException
- Thrown if the move is illegal.
InternalErrorException
- Thrown if the operation fails for any reason.protected final void makeMoveNoEvents(MoveDescriptor md) throws IllegalMoveException, InternalErrorException
md
- The MoveDescriptor which describes the move to make.
IllegalMoveException
- Thrown if the move is illegal.
InternalErrorException
- Thrown if the operation fails for any reason.public final MoveDescriptor requestMove() throws IllegalMoveException, InternalErrorException
IllegalMoveException
- Thrown if the move is illegal.
InternalErrorException
- Thrown if the operation fails for any reason.public abstract void derivedMakeMove(MoveDescriptor md) throws IllegalMoveException, InternalErrorException
md
- The MoveDescriptor which describes the move to make.
IllegalMoveException
- Thrown if the move is illegal.
InternalErrorException
- Thrown if the operation fails for any reason.public abstract MoveDescriptor derivedRequestMove() throws IllegalMoveException, InternalErrorException
IllegalMoveException
- Thrown if the move is illegal.
InternalErrorException
- Thrown if the operation fails for any reason.public abstract short getMoveNumber() throws InternalErrorException
InternalErrorException
public Color getColor()
public Handicap getHandicap()
public abstract boolean isValidatedUser()
public abstract boolean isSelfInitializingUser()
public abstract GameRecord getGameRecord() throws InternalErrorException
InternalErrorException
- Thrown if the
game record cannot be retrieved for any reason.public abstract String getIdentifyingInfo()
public abstract String getId() throws NoSuchDataException
NoSuchDataException
- - Thrown if the player does not have a game id.public void registerMakeMoveListener(MakeMoveListener mml)
mml
- - The MakeMoveListener to be added.public void registerRequestMoveListener(RequestMoveListener rml)
rml
- - The RequestMoveListener to be added.public void registerEndOfGameMoveListener(EndOfGameListener eogl)
eogl
- - The EndOfGameListener to be added.public void unregisterMakeMoveListeners()
public void unregisterRequestMoveListeners()
public void unregisterEndOfGameListeners()
private void makeMoveEventOccurred(MoveDescriptor md)
md
- The MoveDescriptor object.private void requestMoveEventOccurred(MoveDescriptor md)
md
- The MoveDescriptor object.private void endOfGameEventOccurred()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |