public class Player
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected int |
account
The player's account.
|
protected jadex.bridge.IComponentIdentifier |
aid
The player's agent id.
|
protected int |
bet
The player's current bet.
|
protected java.util.List |
cards
The cards held by the player.
|
protected java.awt.Color |
color
The player's color.
|
protected java.lang.Integer |
colorvalue
Hack, necessary because in Java Color is not a bean.
|
protected boolean |
drawcard
The player's decision if to draw another card.
|
protected int |
games
The game counter (incremented when a game is started).
|
protected java.lang.String |
name
The player's name.
|
protected jadex.commons.SimplePropertyChangeSupport |
pcs
The helper object for bean events.
|
protected java.lang.String |
state
The player state.
|
static java.lang.String |
STATE_FINISHED
State of a player when all cards are drawn.
|
static java.lang.String |
STATE_GAME_STARTED
State of a player at game start.
|
static java.lang.String |
STATE_IDLE
State of a player that is not involved in a game.
|
static java.lang.String |
STATE_PLAYING
State of a player, after bet is made.
|
static java.lang.String |
STATE_UNREGISTERED
State of a player that is not involved in a game.
|
protected IStrategy |
strategy
The player's strategy.
|
protected java.lang.String |
strategyname
The strategyname.
|
Constructor and Description |
---|
Player()
Empty bean constructor.
|
Player(jadex.bridge.IComponentIdentifier aid,
java.lang.String name,
int account,
java.awt.Color color,
java.lang.String strategyname)
Create a new Player.
|
Player(java.lang.String name,
int account,
java.awt.Color color,
java.lang.String strategyname)
Create a new Player.
|
Modifier and Type | Method and Description |
---|---|
void |
addCard(Card card)
Add a card.
|
void |
addPropertyChangeListener(jadex.commons.beans.PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list.
|
boolean |
equals(java.lang.Object o)
Test if this player equals another object.
|
int |
getAccount()
Get the account of the player.
|
jadex.bridge.IComponentIdentifier |
getAgentID()
Get the aid of the player.
|
int |
getBet()
Get the bet.
|
Card |
getCard(int idx)
Get a card.
|
int |
getCardCnt()
Get the number of cards.
|
Card[] |
getCards()
Get the cards held by the player.
|
java.awt.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.
|
java.lang.String |
getName()
Get the name of the player.
|
java.lang.String |
getState()
Get the state.
|
IStrategy |
getStrategy()
Get the strategy of the player.
|
java.lang.String |
getStrategyName()
Get the strategy name.
|
int |
hashCode()
Get the hash code of this player.
|
void |
makeBet(int bet)
Make a bet.
|
void |
removePropertyChangeListener(jadex.commons.beans.PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list.
|
void |
setAccount(int account)
Set the account of the player.
|
void |
setAgentID(jadex.bridge.IComponentIdentifier 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 |
setColorValue(int colorvalue)
Set the color value.
|
void |
setName(java.lang.String name)
Set the name of the player.
|
void |
setState(java.lang.String state)
Set the state.
|
void |
setStrategyName(java.lang.String strategyname)
Set the strategy name.
|
java.lang.String |
toString() |
public static final java.lang.String STATE_UNREGISTERED
public static final java.lang.String STATE_IDLE
public static final java.lang.String STATE_GAME_STARTED
public static final java.lang.String STATE_PLAYING
public static final java.lang.String STATE_FINISHED
protected java.lang.String name
protected int account
protected java.awt.Color color
protected java.lang.Integer colorvalue
protected java.lang.String strategyname
protected IStrategy strategy
protected jadex.bridge.IComponentIdentifier aid
protected java.lang.String state
protected int bet
protected boolean drawcard
protected java.util.List cards
protected int games
protected jadex.commons.SimplePropertyChangeSupport pcs
public Player()
public Player(java.lang.String name, int account, java.awt.Color color, java.lang.String strategyname)
public Player(jadex.bridge.IComponentIdentifier aid, java.lang.String name, int account, java.awt.Color color, java.lang.String strategyname)
public java.lang.String getName()
public void setName(java.lang.String name)
public int getAccount()
public void setAccount(int account)
public java.awt.Color getColor()
public int getColorValue()
public void setColorValue(int colorvalue)
colorvalue
- The color value.public IStrategy getStrategy()
public java.lang.String getStrategyName()
public void setStrategyName(java.lang.String strategyname)
strategyname
- The strategy name.public jadex.bridge.IComponentIdentifier getAgentID()
public void setAgentID(jadex.bridge.IComponentIdentifier aid)
public void addCard(Card card)
public Card[] getCards()
public void setCards(Card[] cards)
public Card getCard(int idx)
public void setCard(int idx, Card card)
public int getCardCnt()
public java.lang.String getState()
public void setState(java.lang.String state)
public int getBet()
public void setBet(int bet)
public void makeBet(int bet)
public int getGameCount()
public int getMoneyWon(Card[] dealercards)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public void addPropertyChangeListener(jadex.commons.beans.PropertyChangeListener listener)
listener
- The PropertyChangeListener to be added.public void removePropertyChangeListener(jadex.commons.beans.PropertyChangeListener listener)
listener
- The PropertyChangeListener to be removed.