tables
Class HeartsTable

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

public class HeartsTable
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
HeartsTable()
          Default constructor for HeartsTable that calls the default constructor of Table.
HeartsTable(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 removePlayer in Table so when the player leaves, it also removes his score.
 
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

HeartsTable

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


HeartsTable

public HeartsTable(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 type of game 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 removePlayer in Table so when the player leaves, it also removes his score.

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