|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.moyoman.comm.client.CommandExecutor | +--org.moyoman.comm.client.DirectCommandExecutor
This interface would be used by the client writer to communicate with the server. It makes method calls directly, so the client and server must be on the same machine running in the same virtual machine.
Field Summary | |
private static HashMap |
controllers
The key is the game id, and the value is the Controller object. |
private NonvalidatedPlayerFactory |
nvPlayerFactory
|
private String |
symbolicName
The name of the language to be used by this object. |
Fields inherited from class org.moyoman.comm.client.CommandExecutor |
|
Constructor Summary | |
protected |
DirectCommandExecutor()
Create a new DirectCommandExecutor object. |
Method Summary | |
private PlayerManager |
createPlayerManager(Controller black,
Controller white)
|
void |
deleteActiveGame(String name)
Delete a temporary game on the server. |
void |
deleteSavedGame(String name)
Delete a game from permanent storage on the server. |
protected Color |
getColor(String id)
Get the color to move for the specified game. |
Debug[] |
getDebuggingInfo(String id,
String name,
DebugType[] types)
Get debugging information about a module from the server. |
GameRecord |
getGameRecord(String id)
Get a game record from the server. |
protected Handicap |
getHandicap(String id)
Get the handicap for the specified game. |
String[] |
getLanguageNames()
Get all of the valid language names. |
Stone |
getLastMoveKo(String id)
Get the score from the server. |
String |
getMessage(String name)
Get the message in the specified language. |
protected Mode |
getMode(String id)
Get the mode for the specified game. |
short |
getMoveNumber(String id)
Get the move number for the game. |
MoveDescriptor |
getSuggestedMove(String id)
Get the suggested move from the server. |
Stone[] |
getSuicideMoves(String id)
|
Stone[] |
getSuperKoMoves(String id)
|
boolean |
isActive(String id)
Determine if the specified game is active. |
String[] |
listActiveGames()
List games that are currently active on the server. |
String[] |
listDebuggingModules(String id,
DebugType[] types)
An array of all of the modules which have debugging information. |
String[] |
listSavedGames()
List games permanently stored on the server. |
PlayerManager |
loadGame(String name)
Load a game from the server. |
MoveDescriptor |
makeMove(String id,
Stone st)
Make a move. |
protected String |
newGeneratedGame(Color color,
Handicap handicap,
Mode mode)
Create a new game on the server. |
protected String |
newGeneratedGame(Color color,
Handicap handicap,
Mode mode,
Rules rules,
float komi)
Create a new game on the server. |
protected String |
newValidatedGame(Color color,
Handicap handicap,
Mode mode)
Create a new game on the server. |
protected String |
newValidatedGame(Color color,
Handicap handicap,
Mode mode,
Rules rules,
float komi)
Create a new game on the server. |
void |
onExit()
This method is called before normal shutdown. |
MoveDescriptor |
pass(String id)
Pass in the specified game. |
void |
registerNonvalidatedPlayerFactory(NonvalidatedPlayerFactory nvpf)
|
MoveDescriptor |
requestMove(String id)
Request a move. |
BooleanResponse |
requestResignation(String id)
Request that the server resign. |
void |
resignGame(String id)
Resign the specified game. |
PlayerManager |
resumeGame()
Restart the most recent active game. |
void |
saveGame(PlayerManager pm,
String name)
Save a game on the server. |
void |
setLanguageName(String symName)
Set the language for each game loaded in this controller. |
void |
setProperties(String id,
Properties props)
Set the properties for the id. |
BooleanResponse |
takeBackMove(PlayerManager pm)
Take back a move in the specified game. |
MoveDescriptor |
validateMove(String id,
Stone st)
Validate a move. |
protected void |
writeLastGameInformation(String blackId,
String whiteId)
|
Methods inherited from class org.moyoman.comm.client.CommandExecutor |
get |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static HashMap controllers
private String symbolicName
private NonvalidatedPlayerFactory nvPlayerFactory
Constructor Detail |
protected DirectCommandExecutor()
Method Detail |
public void deleteSavedGame(String name) throws NoSuchDataException, InternalErrorException
deleteSavedGame
in class CommandExecutor
name
- The name under which the game was saved.
NoSuchDataException
- - Thrown if the id is not a saved game.
InternalErrorException
- Thrown if the operation fails for any reason.public void deleteActiveGame(String name) throws NoSuchDataException, InternalErrorException
deleteActiveGame
in class CommandExecutor
name
- The name under which the game was saved.
NoSuchDataException
- - Thrown if the id is not an active game.
InternalErrorException
- Thrown if the operation fails for any reason.public Debug[] getDebuggingInfo(String id, String name, DebugType[] types) throws NoSuchDataException, InternalErrorException
getDebuggingInfo
in class CommandExecutor
id
- The game id.name
- One of the String objects
returned by the listDebuggingModules() method.
It is of the form: moduletype - modulename.types
- An array of DebugType objects supported by the caller.
NoSuchDataException
- - Thrown if the id is not an active game.
InternalErrorException
- Thrown if the operation fails for any reason.public GameRecord getGameRecord(String id) throws NoSuchDataException, InternalErrorException
getGameRecord
in class CommandExecutor
id
- The game id.
NoSuchDataException
- - Thrown if the game does not exist.
InternalErrorException
- Thrown if the operation fails for any reason.public void setProperties(String id, Properties props)
setProperties
in class CommandExecutor
id
- The game id.props
- The properties.
NoSuchDataException
- - Thrown if the game does not exist.
InternalErrorException
- Thrown if the operation fails for any reason.public Stone getLastMoveKo(String id) throws NoSuchDataException, InternalErrorException
CommandExecutor
getLastMoveKo
in class CommandExecutor
id
- The game id.
NoSuchDataException
InternalErrorException
public Stone[] getSuicideMoves(String id) throws NoSuchDataException, InternalErrorException
getSuicideMoves
in class CommandExecutor
NoSuchDataException
InternalErrorException
public Stone[] getSuperKoMoves(String id) throws NoSuchDataException, InternalErrorException
getSuperKoMoves
in class CommandExecutor
NoSuchDataException
InternalErrorException
public MoveDescriptor getSuggestedMove(String id) throws NoSuchDataException, InternalErrorException
getSuggestedMove
in class CommandExecutor
id
- The game id.
NoSuchDataException
- - Thrown if the id is not an active game.
InternalErrorException
- Thrown if the operation fails for any reason.public boolean isActive(String id) throws InternalErrorException
isActive
in class CommandExecutor
id
- The game in question.
InternalErrorException
- Thrown if the operation fails for any reason.public String[] listActiveGames() throws InternalErrorException
listActiveGames
in class CommandExecutor
InternalErrorException
- Thrown if the operation fails for any reason.public String[] listSavedGames() throws InternalErrorException
listSavedGames
in class CommandExecutor
InternalErrorException
- Thrown if the operation fails for any reason.public String[] listDebuggingModules(String id, DebugType[] types) throws NoSuchDataException, InternalErrorException
listDebuggingModules
in class CommandExecutor
id
- The game id.types
- A filter which indicates the desired Debug types.
NoSuchDataException
- - Thrown if the id is not an active game.
InternalErrorException
- Thrown if the operation fails for any reason.public PlayerManager loadGame(String name) throws NoSuchDataException, InternalErrorException
loadGame
in class CommandExecutor
name
- The name of the game to be loaded.
NoSuchDataException
- - Thrown if the id is not a saved game.
InternalErrorException
- Thrown if the operation fails for any reason.private PlayerManager createPlayerManager(Controller black, Controller white) throws InternalErrorException
InternalErrorException
public PlayerManager resumeGame() throws NoSuchDataException, InternalErrorException
resumeGame
in class CommandExecutor
NoSuchDataException
- - Thrown if there is no game to resume.
InternalErrorException
- Thrown if the operation fails for any reason.public MoveDescriptor makeMove(String id, Stone st) throws IllegalMoveException, NoSuchDataException, InternalErrorException
makeMove
in class CommandExecutor
id
- The game id.st
- The stone to be played.
NoSuchDataException
- - Thrown if id is not an active game.
InternalErrorException
- Thrown if the operation fails for any reason.
IllegalMoveException
- Thrown if the move is illegal.public MoveDescriptor validateMove(String id, Stone st) throws IllegalMoveException, NoSuchDataException, InternalErrorException
validateMove
in class CommandExecutor
id
- The game id.st
- The stone to be played.
NoSuchDataException
- - Thrown if id is not an active game.
InternalErrorException
- Thrown if the operation fails for any reason.
IllegalMoveException
- Thrown if the move is illegal.protected String newGeneratedGame(Color color, Handicap handicap, Mode mode, Rules rules, float komi) throws InternalErrorException
newGeneratedGame
in class CommandExecutor
color
- The color of the client .handicap
- The handicap to be used. May be null for no handicap.mode
- One of BEST, FAST, or TOURNAMENT.rules
- The rule set, e.g, Japanese.komi
- The amount of the komi .
InternalErrorException
- Thrown if the operation fails for any reason.protected String newGeneratedGame(Color color, Handicap handicap, Mode mode) throws InternalErrorException
newGeneratedGame
in class CommandExecutor
color
- The color of the client .handicap
- The handicap to be used. May be null for no handicap.mode
- One of BEST, FAST, or TOURNAMENT.
InternalErrorException
- Thrown if the operation fails for any reason.protected String newValidatedGame(Color color, Handicap handicap, Mode mode, Rules rules, float komi) throws InternalErrorException
newValidatedGame
in class CommandExecutor
color
- The color of the client .handicap
- The handicap to be used. May be null for no handicap.mode
- One of BEST, FAST, or TOURNAMENT.rules
- The rule set, e.g, Japanese.komi
- The amount of the komi .
InternalErrorException
- Thrown if the operation fails for any reason.protected String newValidatedGame(Color color, Handicap handicap, Mode mode) throws InternalErrorException
newValidatedGame
in class CommandExecutor
color
- The color of the client .handicap
- The handicap to be used. May be null for no handicap.mode
- One of BEST, FAST, or TOURNAMENT.
InternalErrorException
- Thrown if the operation fails for any reason.public MoveDescriptor pass(String id) throws NoSuchDataException, InternalErrorException
pass
in class CommandExecutor
id
- The game id.
NoSuchDataException
- - Thrown if id is not an active game.
InternalErrorException
- Thrown if the operation fails for any reason.public MoveDescriptor requestMove(String id) throws IllegalMoveException, NoSuchDataException, InternalErrorException
requestMove
in class CommandExecutor
id
- The game id.
IllegalMoveException
- - Thrown if the move is illegal.
NoSuchDataException
- - Thrown if id is not an active game.
InternalErrorException
- Thrown if the operation fails for any reason.public BooleanResponse requestResignation(String id) throws NoSuchDataException, InternalErrorException
requestResignation
in class CommandExecutor
id
- The game id.
NoSuchDataException
- - Thrown if id is not an active game.
InternalErrorException
- Thrown if the operation fails for any reason.public void resignGame(String id) throws NoSuchDataException, InternalErrorException
resignGame
in class CommandExecutor
id
- The game id.
NoSuchDataException
- - Thrown if id is not an active game.
InternalErrorException
- Thrown if the operation fails for any reason.public void saveGame(PlayerManager pm, String name) throws NoSuchDataException, DataAlreadyExistsException, InternalErrorException
saveGame
in class CommandExecutor
pm
- The PlayerManager to be savedname
- The name to save the game as.
NoSuchDataException
- - Thrown if id is not an active game.
DataAlreadyExists
- - Thrown if the newid is already used for storing a game.
InternalErrorException
- Thrown if the operation fails for any reason.
DataAlreadyExistsException
- Thrown if the new id is already used.public BooleanResponse takeBackMove(PlayerManager pm)
takeBackMove
in class CommandExecutor
pm
- The PlayerManager for which the move is to be taken back.
protected void writeLastGameInformation(String blackId, String whiteId)
writeLastGameInformation
in class CommandExecutor
public short getMoveNumber(String id) throws InternalErrorException
getMoveNumber
in class CommandExecutor
id
- - The game id.
InternalErrorException
- Thrown if the operation fails for any reason.public String[] getLanguageNames() throws InternalErrorException
getLanguageNames
in class CommandExecutor
InternalErrorException
- Thrown if the operation fails for any reason.public void setLanguageName(String symName) throws NoSuchDataException, InternalErrorException
setLanguageName
in class CommandExecutor
symName
-
NoSuchDataException
- - Thrown if symName is not a valid language name.
InternalErrorException
- Thrown if the operation fails for any reason.public String getMessage(String name) throws InternalErrorException
getMessage
in class CommandExecutor
name
- - The message name.
InternalErrorException
- Thrown if the operation fails for any reason.protected Color getColor(String id) throws NoSuchDataException, InternalErrorException
getColor
in class CommandExecutor
id
- The game in question.
NoSuchDataException
- - Thrown if id is not an active game.
InternalErrorException
- Thrown if the operation fails for any reason.protected Handicap getHandicap(String id) throws NoSuchDataException, InternalErrorException
getHandicap
in class CommandExecutor
id
- The game in question.
NoSuchDataException
- - Thrown if id is not an active game.
InternalErrorException
- Thrown if the operation fails for any reason.protected Mode getMode(String id) throws NoSuchDataException, InternalErrorException
getMode
in class CommandExecutor
id
- The game in question.
NoSuchDataException
- - Thrown if id is not an active game.
InternalErrorException
- Thrown if the operation fails for any reason.public void registerNonvalidatedPlayerFactory(NonvalidatedPlayerFactory nvpf)
registerNonvalidatedPlayerFactory
in class CommandExecutor
public void onExit()
onExit
in class CommandExecutor
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |