|
|||||||||||
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 | |
static String |
NO_PLAYER
|
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. |
Constructor Summary | |
PlayerList(String owner)
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[] |
getInGamePlayers()
Convience method to return in-game players sorted by seat and in the form of Strings (just the players usernames) |
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 |
getPlayersSortedBySeat()
Return a vector of all the players in this list which are sorted by seat number (used for the game logic). |
Vector |
getPlayersSortedBySeat(String state)
Return a vector of all the players in this list which are currently actually playing a game. |
int |
getPlayerStateCount(String 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 |
nextPlayer(Player player)
Sets the next player |
void |
nextPlayer(String playerName)
Sets the next player |
void |
refreshObservers()
Notify observers. |
void |
removePlayer(String player)
Remove a player. |
void |
resetCurrentPlayer()
Sets the current player to the person with the smallest seat number. |
void |
setCurrentPlayer(String username)
Set current player. |
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 |
protected static final int NUM_OF_HEADER_TOKENS
protected static final int NUM_OF_TOKENS
public static final String NO_PLAYER
Constructor Detail |
public PlayerList(String owner)
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(String playerName)
playerName
- Next playerpublic void nextPlayer(Player player)
player
- Next playerpublic void nextPlayer()
public void setCurrentPlayer(String username)
username
- Username of current player.public void resetCurrentPlayer()
public String getCurrentPlayerName()
public Player getCurrentPlayer()
public Vector getPlayersSortedBySeat(String state)
state
- State of the player e.g. game in state.
public String[] getInGamePlayers()
public Vector getPlayersSortedBySeat()
public int getPlayerStateCount(String 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()
public void refreshObservers()
Observable.notifyObservers()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |