Jadex 0.96

jadex.examples.blackjack
Class Player

java.lang.Object
  extended by jadex.examples.blackjack.Player
Direct Known Subclasses:
Dealer

public class Player
extends Object

Representation of a player.


Field Summary
 SimplePropertyChangeSupport pcs
          The helper object for bean events.
static String STATE_FINISHED
          State of a player when all cards are drawn.
static String STATE_GAME_STARTED
          State of a player at game start.
static String STATE_IDLE
          State of a player that is not involved in a game.
static String STATE_PLAYING
          State of a player, after bet is made.
static String STATE_UNREGISTERED
          .
 
Constructor Summary
Player()
          Empty bean constructor.
Player(AgentIdentifier aid, String name, int account, Color color, String strategyname)
          Create a new Player.
Player(String name, int account, Color color, String strategyname)
          Create a new Player.
 
Method Summary
 void addCard(Card card)
          Add a card.
 void addPropertyChangeListener(PropertyChangeListener listener)
          Add a PropertyChangeListener to the listener list.
 boolean equals(Object o)
          Test if this player equals another object.
 int getAccount()
          Get the account of the player.
 BasicAgentIdentifier getAgentID()
          Get the aid of the player.
 int getBet()
          Get the bet.
 Card getCard(int idx)
          Get a card.
 Card[] getCards()
          Get the cards held by the player.
 Color getColor()
          Get the color of the player.
 int getColorValue()
          Get the color value.
 int getGameCount()
          Get the game counter.
 int getMoneyWon(Card[] dealercards)
          Get the money won in the current game.
 String getName()
          Get the name of the player.
 String getState()
          Get the state.
 IStrategy getStrategy()
          Get the strategy of the player.
 String getStrategyName()
          Get the strategy name.
 int hashCode()
          Get the hash code of this player.
 void makeBet(int bet)
          Make a bet.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Remove a PropertyChangeListener from the listener list.
 void setAccount(int account)
          Set the account of the player.
 void setAgentID(BasicAgentIdentifier aid)
          Set the aid of the player.
 void setBet(int bet)
          Set the bet.
 void setCard(int idx, Card card)
          Get a card.
 void setCards(Card[] cards)
          Get the cards held by the player.
 void setColor(Color color)
          Set the color of the player.
 void setColorValue(int colorvalue)
          Set the color value.
 void setName(String name)
          Set the name of the player.
 void setState(String state)
          Set the state.
 void setStrategy(IStrategy strategy)
          Set the strategy of the player.
 void setStrategyName(String strategyname)
          Set the strategy name.
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

STATE_UNREGISTERED

public static final String STATE_UNREGISTERED
.

See Also:
Constant Field Values

STATE_IDLE

public static final String STATE_IDLE
State of a player that is not involved in a game.

See Also:
Constant Field Values

STATE_GAME_STARTED

public static final String STATE_GAME_STARTED
State of a player at game start.

See Also:
Constant Field Values

STATE_PLAYING

public static final String STATE_PLAYING
State of a player, after bet is made.

See Also:
Constant Field Values

STATE_FINISHED

public static final String STATE_FINISHED
State of a player when all cards are drawn.

See Also:
Constant Field Values

pcs

public SimplePropertyChangeSupport pcs
The helper object for bean events.

Constructor Detail

Player

public Player()
Empty bean constructor.


Player

public Player(String name,
              int account,
              Color color,
              String strategyname)
Create a new Player.


Player

public Player(AgentIdentifier aid,
              String name,
              int account,
              Color color,
              String strategyname)
Create a new Player.

Method Detail

getName

public String getName()
Get the name of the player.


setName

public void setName(String name)
Set the name of the player.


getAccount

public int getAccount()
Get the account of the player.


setAccount

public void setAccount(int account)
Set the account of the player.


getColor

public Color getColor()
Get the color of the player.


setColor

public void setColor(Color color)
Set the color of the player.


getColorValue

public int getColorValue()
Get the color value.

Returns:
The color value.

setColorValue

public void setColorValue(int colorvalue)
Set the color value.

Parameters:
colorvalue - The color value.

getStrategy

public IStrategy getStrategy()
Get the strategy of the player.


setStrategy

public void setStrategy(IStrategy strategy)
Set the strategy of the player.


getStrategyName

public String getStrategyName()
Get the strategy name.

Returns:
The strategy name.

setStrategyName

public void setStrategyName(String strategyname)
Set the strategy name.

Parameters:
strategyname - The strategy name.

getAgentID

public BasicAgentIdentifier getAgentID()
Get the aid of the player.


setAgentID

public void setAgentID(BasicAgentIdentifier aid)
Set the aid of the player.


addCard

public void addCard(Card card)
Add a card.


getCards

public Card[] getCards()
Get the cards held by the player.


setCards

public void setCards(Card[] cards)
Get the cards held by the player.


getCard

public Card getCard(int idx)
Get a card.


setCard

public void setCard(int idx,
                    Card card)
Get a card.


getState

public String getState()
Get the state.


setState

public void setState(String state)
Set the state.


getBet

public int getBet()
Get the bet.


setBet

public void setBet(int bet)
Set the bet.


makeBet

public void makeBet(int bet)
Make a bet.


getGameCount

public int getGameCount()
Get the game counter.


getMoneyWon

public int getMoneyWon(Card[] dealercards)
Get the money won in the current game.


equals

public boolean equals(Object o)
Test if this player equals another object.

Overrides:
equals in class Object

hashCode

public int hashCode()
Get the hash code of this player.

Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. The listener is registered for all properties.

Parameters:
listener - The PropertyChangeListener to be added.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.

Parameters:
listener - The PropertyChangeListener to be removed.

Jadex 0.96

Submit a bug or feature
For further API reference and developer documentation, see the Jadex User Guide and the Jadex Tutorial. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, and working code examples.

Copyright (C) 2002-2007 Lars Braubach, Alexander Pokahr - University of Hamburg. Use is subject to license terms.