|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Observable
org.jogre.common.PlayerList
This class contains a list of Player object.s
Field Summary | |
protected static int |
NUM_OF_HEADER_TOKENS
Number of header tokens. |
protected static int |
NUM_OF_TOKENS
Number of tokens which a PlayerList flattens to. |
static String |
XML_NAME
Header token String. |
Constructor Summary | |
PlayerList()
Default constructor. |
|
PlayerList(XMLElement message)
Constructor which creates a Player object from the flatten () method of another Player object. |
Method Summary | |
void |
addPlayer(String playerName)
Add a player to the table. |
boolean |
containsUser(String player)
Return true if the list contains the player. |
XMLElement |
flatten()
Flatten the String so that it can be transmitted. |
Player |
getCurrentPlayer()
Return the currrent layer at a turned based table. |
String |
getCurrentPlayerName()
Return the currrent layer at a turned based table. |
String |
getOwner()
Return the owner of this table. |
Player |
getPlayer(int seatNum)
Return a player from a seat number. |
Player |
getPlayer(String playerName)
Return a player. |
Vector |
getPlayers()
Return a vector of players which arn't sorted. |
Vector |
getPlayersSortedByName()
Return a vector of all the players in this list which are sorted by name (used for visual lists etc). |
Vector |
getPlayersSortedBySeat()
Return a vector of all the players in this list which are sorted by seat number (used for the game logic). |
Vector |
getPlayersSortedBySeat(int state)
Return a vector of all the players in this list which are currently actually playing a game. |
int |
getPlayerStateCount(int state)
Returns the number of players in a particular state. |
boolean |
isSeatFree(int seatNum)
Return true if a seat at a table is free. |
void |
nextPlayer()
Makes the current player equal to the next player. |
void |
removePlayer(String player)
Remove a player. |
void |
resetCurrentPlayer()
Sets the current player to the person with the smallest seat number. |
int |
size()
Return the number of users playing at a particular table. |
String |
toString()
|
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
protected static final int NUM_OF_HEADER_TOKENS
protected static final int NUM_OF_TOKENS
Constructor Detail |
public PlayerList()
public PlayerList(XMLElement message)
message
- XML element version of object.Method Detail |
public void addPlayer(String playerName)
playerName
- Name of the player to add to table.public void removePlayer(String player)
player
- Name of player to remove.public int size()
public boolean containsUser(String player)
player
- Username of player
public String getOwner()
public Player getPlayer(String playerName)
playerName
- Username of player.
public Player getPlayer(int seatNum)
seatNum
- Seat number of a user.
public Vector getPlayers()
public void nextPlayer()
public void resetCurrentPlayer()
public String getCurrentPlayerName()
public Player getCurrentPlayer()
public Vector getPlayersSortedByName()
public Vector getPlayersSortedBySeat(int state)
state
- State of the player e.g. game in state.
public Vector getPlayersSortedBySeat()
public int getPlayerStateCount(int state)
state
-
public boolean isSeatFree(int seatNum)
seatNum
- Seat number to check.
public XMLElement flatten()
flatten
in interface ITransmittable
ITransmittable.flatten()
public String toString()
Object.toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |