org.ninm.games.cardgames.common
Class DefaultPlayer

java.lang.Object
  |
  +--org.ninm.games.cardgames.common.DefaultPlayer
All Implemented Interfaces:
Player

public class DefaultPlayer
extends java.lang.Object
implements Player

The default implementation of a player

Version:
1.0
Author:
Nikolay

Field Summary
private  java.util.Set m_announcedTricks
           
private  java.util.Set m_hand
           
private  boolean m_isDealer
           
private  java.lang.String m_name
           
private  Team m_team
           
 
Constructor Summary
DefaultPlayer(java.lang.String name, Team team)
           
 
Method Summary
 void addAnnouncedTrick(Trick trick)
           
 void addCard(Card card)
          adds the card to the hand
 void clearTricks()
           
 java.util.Set getAnnouncedTricks()
          returns the tricks announced by the player
 java.util.Set getCardsFrom(Suit suit)
          retuns all the cards from the specified suit
 java.util.Set getHand()
          returns the cards currently in this players hand
 java.lang.String getName()
          returns the name of this player
 Team getTeam()
          returns the team that this player belongs to
 boolean isDealer()
          returns true if this player is a dealer
 void removeCard(Card card)
          removes the card from the hand
 void setIsDealer(boolean isDealer)
          sets this player dealer status
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_name

private final java.lang.String m_name

m_team

private final Team m_team

m_announcedTricks

private java.util.Set m_announcedTricks

m_hand

private java.util.Set m_hand

m_isDealer

private boolean m_isDealer
Constructor Detail

DefaultPlayer

public DefaultPlayer(java.lang.String name,
                     Team team)
Method Detail

isDealer

public boolean isDealer()
Description copied from interface: Player
returns true if this player is a dealer

Specified by:
isDealer in interface Player
Returns:
boolean

getTeam

public Team getTeam()
Description copied from interface: Player
returns the team that this player belongs to

Specified by:
getTeam in interface Player
Returns:
Team the players team

getName

public java.lang.String getName()
Description copied from interface: Player
returns the name of this player

Specified by:
getName in interface Player
Returns:
String the name of this player

getHand

public java.util.Set getHand()
Description copied from interface: Player
returns the cards currently in this players hand

Specified by:
getHand in interface Player
Returns:
Set a set of cards in this players hand

getCardsFrom

public java.util.Set getCardsFrom(Suit suit)
retuns all the cards from the specified suit

Parameters:
suit - the suit that is needed
Returns:
List all the cards in this players hand from that suit

setIsDealer

public void setIsDealer(boolean isDealer)
sets this player dealer status

Parameters:
isDealer - if true then this player is the dealer, false otherwise

addCard

public void addCard(Card card)
adds the card to the hand

Parameters:
card - the card to be added

removeCard

public void removeCard(Card card)
removes the card from the hand

Parameters:
card -

getAnnouncedTricks

public java.util.Set getAnnouncedTricks()
Description copied from interface: Player
returns the tricks announced by the player

Specified by:
getAnnouncedTricks in interface Player
Returns:
Set aset of tricks announced by the player

addAnnouncedTrick

public void addAnnouncedTrick(Trick trick)

clearTricks

public void clearTricks()

toString

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

SourceForge.net Logo