tables
Class SpadesTable

java.lang.Object
  extended by common.Table
      extended by tables.SpadesTable

public class SpadesTable
extends Table


Field Summary
 
Fields inherited from class common.Table
deck, DRAW, FULL, hands, LOSS, NUMBER_OF_GAMES, numPlayers, players, started, type, WIN
 
Constructor Summary
SpadesTable()
          Default constructor for SpadesTable that calls the default constructor of Table.
SpadesTable(int numPlayers, java.lang.String type)
          Constructs a new Table with the specified amount of players needed at this Table to start the game and the ServerThread associated with the first player (master) at this Table.
 
Method Summary
 void beginGame()
          Deals 13 cards to each player and puts them in each player's hand.
 void handleMessage(java.lang.Object o, int fromClientNum)
          Handles incoming messages from players at this table.
 void removePlayer(ServerThread player)
          Overrides the removePlayer in Table.
 
Methods inherited from class common.Table
addPlayer, getNextAvailableSlot, getType, initialize, removePlayer, sendResults, sendTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpadesTable

public SpadesTable()
Default constructor for SpadesTable that calls the default constructor of Table.


SpadesTable

public SpadesTable(int numPlayers,
                   java.lang.String type)
Constructs a new Table with the specified amount of players needed at this Table to start the game and the ServerThread associated with the first player (master) at this Table.

Parameters:
numPlayers - int is the number of players needed at this Table to start the game.
type - String is the game that is being played at this table. at this Table.
Method Detail

handleMessage

public void handleMessage(java.lang.Object o,
                          int fromClientNum)
Handles incoming messages from players at this table. Takes the appropriate action based on the incoming message.

Specified by:
handleMessage in class Table
Parameters:
o - Object the incoming message.
fromClientNum - int the player number of the player that sent this message.

beginGame

public void beginGame()
Deals 13 cards to each player and puts them in each player's hand. Sends those cards to the players. Called when the table is full.

Specified by:
beginGame in class Table

removePlayer

public void removePlayer(ServerThread player)
Overrides the removePlayer in Table. Used to delete the specified player's records from the table. Then calls super.removePlayer(player).

Overrides:
removePlayer in class Table
Parameters:
player - ServerThread that left the table.