|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectsoc.server.SOCGameList
A class for creating and tracking the games
| Field Summary | |
static int |
GAME_EXPIRE_MINUTES
Number of minutes after which a game (created on the list) is expired. |
protected java.util.Hashtable |
gameData
map of game names to SOCGame objects |
protected java.util.Hashtable |
gameMembers
map of game names to Vector of game members |
protected java.util.Hashtable |
gameMutexes
mutexes to synchronize game state access |
protected boolean |
inUse
used with gamelist's monitor |
| Constructor Summary | |
SOCGameList()
constructor |
|
| Method Summary | |
void |
addMember(StringConnection conn,
java.lang.String gaName)
add a member to the game. |
void |
createGame(java.lang.String gaName)
create a new game, and add to the list; game will expire in GAME_EXPIRE_MINUTES. |
void |
deleteGame(java.lang.String gaName)
remove the game from the list |
SOCGame |
getGameData(java.lang.String gaName)
|
java.util.Enumeration |
getGames()
|
java.util.Vector |
getMembers(java.lang.String gaName)
|
boolean |
isGame(java.lang.String gaName)
|
boolean |
isGameEmpty(java.lang.String gaName)
|
boolean |
isMember(StringConnection conn,
java.lang.String gaName)
|
void |
releaseMonitor()
release the monitor for this game list |
boolean |
releaseMonitorForGame(java.lang.String game)
release the monitor for this game |
void |
removeMember(StringConnection conn,
java.lang.String gaName)
remove member from the game. |
SOCGameBoardReset |
resetBoard(java.lang.String gaName)
Reset the board of this game, create a new game of same name, same players, new layout. |
void |
takeMonitor()
take the monitor for this game list |
boolean |
takeMonitorForGame(java.lang.String game)
take the monitor for this game |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static int GAME_EXPIRE_MINUTES
createGame(String)protected java.util.Hashtable gameMutexes
protected java.util.Hashtable gameMembers
protected java.util.Hashtable gameData
protected boolean inUse
| Constructor Detail |
public SOCGameList()
| Method Detail |
public void takeMonitor()
public void releaseMonitor()
public boolean takeMonitorForGame(java.lang.String game)
game - the name of the game
public boolean releaseMonitorForGame(java.lang.String game)
game - the name of the game
public java.util.Enumeration getGames()
public boolean isGameEmpty(java.lang.String gaName)
gaName - the name of the game
public java.util.Vector getMembers(java.lang.String gaName)
gaName - game name
public SOCGame getGameData(java.lang.String gaName)
gaName - game name
public boolean isMember(StringConnection conn,
java.lang.String gaName)
gaName - the name of the gameconn - the member's connection
public void addMember(StringConnection conn,
java.lang.String gaName)
takeMonitorForGame(String) before calling this.
gaName - the name of the gameconn - the member's connection; version should already be set
public void removeMember(StringConnection conn,
java.lang.String gaName)
takeMonitorForGame(String) before calling this.
gaName - the name of the gameconn - the member's connectionpublic boolean isGame(java.lang.String gaName)
gaName - the name of the game
public void createGame(java.lang.String gaName)
isGame(String)), do nothing.
gaName - the name of the gameGAME_EXPIRE_MINUTESpublic SOCGameBoardReset resetBoard(java.lang.String gaName)
gaName - Name of game - If not found, do nothing. No monitor is taken.
SOCGame.resetAsCopy(),
releaseMonitorForGame(String)public void deleteGame(java.lang.String gaName)
gaName - the name of the game
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||