Blackjack

com.amoebacode.blackjack.core
Class Participant

java.lang.Object
  |
  +--com.amoebacode.blackjack.core.GameObject
        |
        +--com.amoebacode.blackjack.core.Participant
All Implemented Interfaces:
IGameObject, IParticipant
Direct Known Subclasses:
Dealer, Player

abstract class Participant
extends GameObject
implements IParticipant

Participant is the base class for the round participants (Dealer and Player), managing the corresponding hands.

Version:
0.9
Author:
Jason Gurney

Field Summary
private  java.util.List hands
          The collection of hands controlled by the participant
 
Fields inherited from class com.amoebacode.blackjack.core.GameObject
listeners, parent
 
Constructor Summary
protected Participant(IRound round)
          Default protected constructor.
 
Method Summary
protected  void addHand(IHand hand)
          Adds the specified hand to this participant's collection of hands.
 boolean allHandsBlackjack()
          Indicates whether all hands for this participant have blackjack.
 void clear()
          Removes each of this participant's hands from the table.
 IHand getFirstHand()
          Returns the first hand for this participant.
protected  IHand getHandAt(int index)
          Returns the specified participant hand.
 int getNumberOfHands()
          Returns the number of hands being controlled by this participant.
protected  IRound getRound()
          Returns the current round.
 
Methods inherited from class com.amoebacode.blackjack.core.GameObject
addEventListener, getEventListenerCollection, getGame, getParent, hasParent, setEventListenerCollection
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 
Methods inherited from interface com.amoebacode.blackjack.core.IParticipant
setupFirstHand
 
Methods inherited from interface com.amoebacode.blackjack.core.IGameObject
addEventListener, getGame, getParent
 

Field Detail

hands

private java.util.List hands
The collection of hands controlled by the participant
Constructor Detail

Participant

protected Participant(IRound round)
Default protected constructor.
Parameters:
round - the IRound parent of this participant
Method Detail

addHand

protected void addHand(IHand hand)
Adds the specified hand to this participant's collection of hands.
Parameters:
hand - the IHand to add

getNumberOfHands

public int getNumberOfHands()
Description copied from interface: IParticipant
Returns the number of hands being controlled by this participant.
Specified by:
getNumberOfHands in interface IParticipant
See Also:
IParticipant.getNumberOfHands()

getHandAt

protected IHand getHandAt(int index)
Returns the specified participant hand.
Parameters:
index - the index of the specified hand
Returns:
the specified IHand

getFirstHand

public IHand getFirstHand()
Description copied from interface: IParticipant
Returns the first hand for this participant.
Specified by:
getFirstHand in interface IParticipant
See Also:
IParticipant.getFirstHand()

getRound

protected IRound getRound()
Returns the current round.
Returns:
the IRound parent of this participant

clear

public void clear()
Description copied from interface: IParticipant
Removes each of this participant's hands from the table.
Specified by:
clear in interface IParticipant
See Also:
IParticipant.clear()

allHandsBlackjack

public boolean allHandsBlackjack()
Description copied from interface: IParticipant
Indicates whether all hands for this participant have blackjack.
Specified by:
allHandsBlackjack in interface IParticipant
See Also:
IParticipant.allHandsBlackjack()

Blackjack

Copyright © 2002 amoebacode.com.