blackjackanalyst
Class Player

java.lang.Object
  extended by blackjackanalyst.Player

public class Player
extends java.lang.Object

A player at a blackjack table.

Author:
Michael Parker

Constructor Summary
Player(PlayerStrategy _bj_strategy)
          Creates an unnamed blackjack player with the given strategy and the default bankroll of 500.
Player(PlayerStrategy _bj_strategy, int _bankroll)
          Creates an unnamed blackjack player with the given strategy and bankroll.
Player(PlayerStrategy _bj_strategy, int _bankroll, java.lang.String player_name)
          Creates a named blackjack player with the given strategy and bankroll.
Player(PlayerStrategy _bj_strategy, java.lang.String player_name)
          Creates a named blackjack player with the given strategy and the default bankroll of 500.
 
Method Summary
 int getBankroll()
          Returns the bankroll of the player.
 java.lang.String getName()
          Returns the name of the player.
 ObserverList<PlayerObserver> getObservers()
          Returns the list of observers, to which observers for this player can be added, removed, and so forth.
 PlayerStrategy getStrategy()
          Returns the strategy used by the player.
 Table getTable()
          Returns the table this player is playing blackjack at.
 int setBankroll(int new_bankroll)
          Sets the bankroll of the player to new_bankroll.
 PlayerStrategy setStrategy(PlayerStrategy new_strategy)
          Sets the strategy of the player to new_strategy.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Player

public Player(PlayerStrategy _bj_strategy)
Creates an unnamed blackjack player with the given strategy and the default bankroll of 500.

Parameters:
_bj_strategy - the strategy the blackjack player will use

Player

public Player(PlayerStrategy _bj_strategy,
              java.lang.String player_name)
Creates a named blackjack player with the given strategy and the default bankroll of 500.

Parameters:
_bj_strategy - the strategy the blackjack player will use
player_name - the name of the player

Player

public Player(PlayerStrategy _bj_strategy,
              int _bankroll)
Creates an unnamed blackjack player with the given strategy and bankroll.

Parameters:
_bj_strategy - the strategy the blackjack player will use
_bankroll - the starting bankroll of the player

Player

public Player(PlayerStrategy _bj_strategy,
              int _bankroll,
              java.lang.String player_name)
Creates a named blackjack player with the given strategy and bankroll.

Parameters:
_bj_strategy - the strategy the blackjack player will use
_bankroll - the starting bankroll of the player
player_name - the name of the player
Method Detail

getTable

public Table getTable()
Returns the table this player is playing blackjack at. If this player is not playing at any table, this method returns null.

Returns:
the blackjack table of this player

setStrategy

public PlayerStrategy setStrategy(PlayerStrategy new_strategy)
Sets the strategy of the player to new_strategy. The previous strategy of the player is returned.

Parameters:
new_strategy - the new player strategy
Returns:
the previous player strategy

getStrategy

public PlayerStrategy getStrategy()
Returns the strategy used by the player.

Returns:
the player strategy

setBankroll

public int setBankroll(int new_bankroll)
Sets the bankroll of the player to new_bankroll. The previous bankroll is returned.

Parameters:
new_bankroll - the new player bankroll
Returns:
the previous player bankroll

getBankroll

public int getBankroll()
Returns the bankroll of the player.

Returns:
the player bankroll

getName

public java.lang.String getName()
Returns the name of the player.

Returns:
the player name

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getObservers

public ObserverList<PlayerObserver> getObservers()
Returns the list of observers, to which observers for this player can be added, removed, and so forth.

Returns:
the list of observers for this player