|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcommon.Table
public abstract class Table
| Field Summary | |
|---|---|
protected Deck |
deck
|
static java.lang.String |
DRAW
Indicates that the player drew. |
static int |
FULL
Returned by getNextAvailableSlot() when the table is full or the game has already started. |
protected java.util.Vector<Hand> |
hands
|
static java.lang.String |
LOSS
Indicates that the player lost. |
static int |
NUMBER_OF_GAMES
The number of games the framework currently supports. |
protected int |
numPlayers
|
protected java.util.Vector<ServerThread> |
players
|
protected boolean |
started
|
protected java.lang.String |
type
|
static java.lang.String |
WIN
Indicates that the player won. |
| Constructor Summary | |
|---|---|
Table()
Default constructor. |
|
Table(int numPlayers,
java.lang.String type)
Creates a new table with the number of players that are needed at the table to start the game and the type of Table this is. |
|
| Method Summary | |
|---|---|
void |
addPlayer(ServerThread s)
Adds an additional player to the table. |
abstract void |
beginGame()
Called when the table is FULL. |
int |
getNextAvailableSlot()
Returns FULL if the Table is full, otherwise returns the next available slot. |
java.lang.String |
getType()
Returns a String representation of the type of game being played at this table. |
abstract void |
handleMessage(java.lang.Object o,
int fromClientNum)
Receive messages from ServerThread (from a Client), checks to see if a move causes a win, loss, or draw, then if not, passes that move to the other players. |
void |
initialize(int numPlayers,
java.lang.String type)
Initializes a new table with the number of players that are needed at the table to start the game and the type of Table this is. |
void |
removePlayer(int playerNum)
Removes the specified player from the table. |
void |
removePlayer(ServerThread player)
Removes the specified player from the table. |
void |
sendResults(java.lang.String[] results)
Sends the given results to the players and updates player records. |
void |
sendTo(java.lang.Object msg,
int clientToSendTo)
Sends a NetworkObject to the specified client in the ServerThread array. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int NUMBER_OF_GAMES
public static final java.lang.String WIN
public static final java.lang.String DRAW
public static final java.lang.String LOSS
public static final int FULL
protected java.util.Vector<ServerThread> players
protected java.util.Vector<Hand> hands
protected int numPlayers
protected java.lang.String type
protected Deck deck
protected boolean started
| Constructor Detail |
|---|
public Table()
public Table(int numPlayers,
java.lang.String type)
numPlayers - int number of players that are needed at the table to start
the game.type - String of Table this is.| Method Detail |
|---|
public void initialize(int numPlayers,
java.lang.String type)
numPlayers - int number of players that are needed at the table to start
the game.type - String of Table this is.
public abstract void handleMessage(java.lang.Object o,
int fromClientNum)
o - Object received from the player.fromClientNum - int the player number that sent this message.public abstract void beginGame()
public void sendResults(java.lang.String[] results)
results - String[] that need to be sent to each player.public int getNextAvailableSlot()
public void addPlayer(ServerThread s)
s - ServerThread Associated with the player that just joined the Table.
public void sendTo(java.lang.Object msg,
int clientToSendTo)
msg - Object to send to the player.clientToSendTo - int the player number that this message is being sent to.public void removePlayer(ServerThread player)
player - ServerThread the player that left the table.public void removePlayer(int playerNum)
playerNum - int of the player that left the table.public java.lang.String getType()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||