org.jogre.common
Class Game

java.lang.Object
  extended byjava.util.Observable
      extended byorg.jogre.common.Game
All Implemented Interfaces:
ITransmittable

public class Game
extends Observable
implements ITransmittable

Game class which extends the data class.

Version:
Alpha 0.2.3
Author:
Bob Marks

Field Summary
protected  String gameKey
          Game key - e.g.
protected  TableList tableList
          List of tables current being played on this server.
protected  UserList userList
          List of users which are currently connected to the server.
 
Constructor Summary
Game(String gameKey, int minNumOfPlayers, int maxNumOfPlayers)
          Constructor to a Game object.
Game(XMLElement message)
          Game constructor which takes an XMLElement as a parameter.
 
Method Summary
 XMLElement flatten()
          Flatten this object.
 String getGameStr()
          Return the game part of the game key.
 String getKey()
          Return the key of the game.
 int getMaxNumOfPlayers()
          Return the minimum number of players in a game.
 int getMinNumOfPlayers()
          Return the minimum number of players in a game.
 TableList getTableList()
          Return the TableList object or table currently being played.
 UserList getUserList()
          Returns the UserList object of current connected users.
 void setTableList(TableList tableList)
          Set the table list.
 void setUserList(UserList userlist)
          Set the userlist.
 String toString()
          Return the game as a String.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

gameKey

protected String gameKey
Game key - e.g. chess-0.1.


userList

protected UserList userList
List of users which are currently connected to the server.


tableList

protected TableList tableList
List of tables current being played on this server.

Constructor Detail

Game

public Game(String gameKey,
            int minNumOfPlayers,
            int maxNumOfPlayers)
Constructor to a Game object.

Parameters:
gameKey - Game key

Game

public Game(XMLElement message)
     throws TransmissionException
Game constructor which takes an XMLElement as a parameter.

Parameters:
message -
Throws:
TransmissionException
Method Detail

getKey

public String getKey()
Return the key of the game.

Returns:

getGameStr

public String getGameStr()
Return the game part of the game key.

Returns:

getMinNumOfPlayers

public int getMinNumOfPlayers()
Return the minimum number of players in a game.

Returns:
Max num of players.

getMaxNumOfPlayers

public int getMaxNumOfPlayers()
Return the minimum number of players in a game.

Returns:
Max num of players.

getUserList

public UserList getUserList()
Returns the UserList object of current connected users.

Returns:

setUserList

public void setUserList(UserList userlist)
Set the userlist.

Parameters:
userlist - New userlist which replaces the older one.

setTableList

public void setTableList(TableList tableList)
Set the table list.

Parameters:
tableList - New tablelist which replaces the older one.

getTableList

public TableList getTableList()
Return the TableList object or table currently being played.

Returns:

toString

public String toString()
Return the game as a String.

See Also:
Object.toString()

flatten

public XMLElement flatten()
Flatten this object.

Specified by:
flatten in interface ITransmittable
Returns:
XML version of the state of an object which can be constructed again.
See Also:
ITransmittable.flatten()