|
|||||||||||
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
|
static String |
XML_NAME
Header in XMLElement. |
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 |
containsUser(String user)
Returns true if a specified user is at a table. |
XMLElement |
flatten()
Flatten this object without the model state attached (this is the default way of doing things). |
XMLElement |
flatten(boolean modelStateAttached)
Flatten the table object. |
void |
gameOver()
Game over. |
int |
getMaxNumOfPlayers()
Return the maximum number of players as specified by a client through a property. |
int |
getMinNumOfPlayers()
Return the minimum number of players as specified by a client through a property. |
JogreModel |
getModel()
Retrieve the model from the server (if its being used). |
String |
getOwner()
Get the owner of this table. |
PlayerList |
getPlayerList()
Return a player list. |
JogrePropertyHash |
getProperties()
Return the properties hash. |
int |
getRequiredNumOfPlayers()
Return the maximum number of players as specified by a client through a property. |
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 |
isModelStateAttached()
Return if the model state is attached or not. |
boolean |
isPublic()
Returns true if this is a public table. |
void |
nextPlayer()
Sets the next player username. |
void |
removePlayer(String player)
Remove a player from the list. |
void |
setModel(JogreModel model)
Set the game data. |
void |
setModelStateAttached(boolean value)
Set true if the model state is to be attached or not. |
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 XML_NAME
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 void addPlayer(String playerName)
playerName
- Username of the player.public void removePlayer(String player)
player
- Username of the player.public void gameOver()
public int getTableNum()
public int getMinNumOfPlayers()
public int getMaxNumOfPlayers()
public int getRequiredNumOfPlayers()
public PlayerList getPlayerList()
public boolean containsUser(String user)
user
- Username to check.
public String getOwner()
public boolean isPublic()
public JogreModel getModel()
public void setModel(JogreModel model)
model
- public void nextPlayer()
public void setModelStateAttached(boolean value)
value
- public boolean isModelStateAttached()
public XMLElement flatten(boolean modelStateAttached)
modelStateAttached
- Boolean to specify to include the model or not.
public String getTimeFormatted()
public XMLElement flatten()
flatten
in interface ITransmittable
ITransmittable.flatten()
public String toString()
Object.toString()
public boolean isGamePlaying()
public JogrePropertyHash getProperties()
getProperties
in interface ITransmittableWithProps
ITransmittableWithProps.getProperties()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |