JSettlers v1.0.6 API
Built ${date}

soc.server
Class SOCGameList

java.lang.Object
  extended bysoc.server.SOCGameList

public class SOCGameList
extends java.lang.Object

A class for tracking the games

Author:
Robert S. Thomas

Field Summary
protected  java.util.Hashtable gameData
           
protected  java.util.Hashtable gameMembers
           
protected  java.util.Hashtable gameMutexes
           
protected  boolean inUse
           
 
Constructor Summary
SOCGameList()
          constructor
 
Method Summary
 void addMember(Connection conn, java.lang.String gaName)
          add a member to the game
 void createGame(java.lang.String gaName)
          create a new game
 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(Connection 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(Connection conn, java.lang.String gaName)
          remove member from the game
 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

gameMutexes

protected java.util.Hashtable gameMutexes

gameMembers

protected java.util.Hashtable gameMembers

gameData

protected java.util.Hashtable gameData

inUse

protected boolean inUse
Constructor Detail

SOCGameList

public SOCGameList()
constructor

Method Detail

takeMonitor

public void takeMonitor()
take the monitor for this game list


releaseMonitor

public void releaseMonitor()
release the monitor for this game list


takeMonitorForGame

public boolean takeMonitorForGame(java.lang.String game)
take the monitor for this game

Parameters:
game - the name of the game
Returns:
false if the game has no mutex

releaseMonitorForGame

public boolean releaseMonitorForGame(java.lang.String game)
release the monitor for this game

Parameters:
game - the name of the game
Returns:
false if the game has no mutex

getGames

public java.util.Enumeration getGames()
Returns:
an enumeration of game names

isGameEmpty

public boolean isGameEmpty(java.lang.String gaName)
Parameters:
gaName - the name of the game
Returns:
true if the channel exists and has an empty member list

getMembers

public java.util.Vector getMembers(java.lang.String gaName)
Parameters:
gaName - game name
Returns:
list of members

getGameData

public SOCGame getGameData(java.lang.String gaName)
Parameters:
gaName - game name
Returns:
the game data

isMember

public boolean isMember(Connection conn,
                        java.lang.String gaName)
Parameters:
gaName - the name of the game
conn - the member's connection
Returns:
true if memName is a member of the game

addMember

public void addMember(Connection conn,
                      java.lang.String gaName)
add a member to the game

Parameters:
gaName - the name of the game
conn - the member's connection

removeMember

public void removeMember(Connection conn,
                         java.lang.String gaName)
remove member from the game

Parameters:
gaName - the name of the game
conn - the member's connection

isGame

public boolean isGame(java.lang.String gaName)
Parameters:
gaName - the name of the game
Returns:
true if the game exists

createGame

public void createGame(java.lang.String gaName)
create a new game

Parameters:
gaName - the name of the game

deleteGame

public void deleteGame(java.lang.String gaName)
remove the game from the list

Parameters:
gaName - the name of the game

JSettlers v1.0.6 API
Built ${date}