|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Observable
org.jogre.common.Table
Server side data object which holds information on various tables and their current users etc.
This class implements the ITransmittable and be transmitabled to a client. It also extends the Observable interface so that other class can listen to changes on the data.
Field Summary | |
static String |
NUM_OF_PLAYERS
|
Fields inherited from interface org.jogre.common.comm.ITransmittableWithProps |
XML_ATT_PROPERTIES |
Constructor Summary | |
Table(int tableNumber,
String username,
boolean isPublic,
JogrePropertyHash properties)
Create a table and 1 user (owner) |
|
Table(XMLElement message)
Create Table object from a String. |
Method Summary | |
void |
addPlayer(String playerName)
Add a user to the table i.e. |
void |
addProperty(String key,
String value)
Add a property to the hash map. |
boolean |
containsPlayer(String user)
Returns true if a specified user is at a table. |
XMLElement |
flatten()
Flatten the table object. |
void |
gameOver()
Game over. |
JogreModel |
getModel()
Retrieve the model from the server (if its being used). |
int |
getNumOfPlayers()
Return the number of players as specified by a client through a property. |
String |
getOwner()
Get the owner of this table. |
PlayerList |
getPlayerList()
Return a player list. |
JogrePropertyHash |
getProperties()
Return the properties hash. |
String |
getProperty(String key)
Return a property from a key. |
String |
getProperty(String key,
String defaultValue)
Return a property from a key. |
Date |
getStartTime()
Return the time this table was created. |
int |
getTableNum()
Get the number of this table. |
String |
getTimeFormatted()
Return the time started as a String. |
boolean |
isGamePlaying()
Return true if a game is in progress. |
boolean |
isPublic()
Returns true if this is a public table. |
void |
nextPlayer()
Sets the next player username. |
void |
nextPlayer(Player player)
Sets the next player. |
void |
nextPlayer(String playerName)
Sets the next player. |
void |
refreshObservers()
Refresh observers - calls the setChanged() and notifyObservers () methods in the Observable class. |
void |
setModel(JogreModel model)
Set the game data. |
void |
setPlayerList(PlayerList playerList)
|
String |
toString()
Return the String version of this table. |
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 |
public static final String NUM_OF_PLAYERS
Constructor Detail |
public Table(int tableNumber, String username, boolean isPublic, JogrePropertyHash properties)
tableNumber
- The table number of the new table.username
- Username (owner).isPublic
- boolean to show if a table is public or private.public Table(XMLElement message) throws TransmissionException
message
- XMLElement communication object.
TransmissionException
- Thrown if there is a problem in transmission.
NumberFormatException
- Problem parsing an int.Method Detail |
public void addProperty(String key, String value)
addProperty
in interface ITransmittableWithProps
key
- Key of the value to add.value
- Value of the propertypublic String getProperty(String key, String defaultValue)
key
-
public String getProperty(String key)
key
-
public void addPlayer(String playerName)
playerName
- Username of the player.public void gameOver()
public int getTableNum()
public Date getStartTime()
public int getNumOfPlayers()
public PlayerList getPlayerList()
public void setPlayerList(PlayerList playerList)
public boolean containsPlayer(String user)
user
- Username to check.
public String getOwner()
public boolean isPublic()
public JogreModel getModel()
public void setModel(JogreModel model)
model
- public void nextPlayer(String playerName)
public void nextPlayer(Player player)
public void nextPlayer()
public XMLElement flatten()
flatten
in interface ITransmittable
public String getTimeFormatted()
public String toString()
Object.toString()
public boolean isGamePlaying()
public JogrePropertyHash getProperties()
getProperties
in interface ITransmittableWithProps
ITransmittableWithProps.getProperties()
public void refreshObservers()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |