Blackjack

com.amoebacode.blackjack.core
Class DealerHand

java.lang.Object
  |
  +--com.amoebacode.blackjack.core.GameObject
        |
        +--com.amoebacode.blackjack.core.CardCollection
              |
              +--com.amoebacode.blackjack.core.Hand
                    |
                    +--com.amoebacode.blackjack.core.DealerHand
All Implemented Interfaces:
ICardCollection, IDealerHand, IGameObject, IHand

class DealerHand
extends Hand
implements IDealerHand

DealerHand manages the dealer's hand.

Version:
0.9
Author:
Jason Gurney

Field Summary
private  boolean isWaitingForPlayer
          Indicates whether the player hands have completed
 
Fields inherited from class com.amoebacode.blackjack.core.Hand
MAXIMUM_HARD_CARD_SCORE, MAXIMUM_NUMBER_OF_CARDS, MAXIMUM_SCORE
 
Fields inherited from class com.amoebacode.blackjack.core.CardCollection
cards
 
Fields inherited from class com.amoebacode.blackjack.core.GameObject
listeners, parent
 
Constructor Summary
protected DealerHand(IDealer dealer)
          Default public constructor.
 
Method Summary
 void assumeControl()
          Turns over the face-down card and notifies the GUI listeners (called when all of the player hands have finished).
 boolean firstCardIsAce()
          Indicates whether the first card in this hand is an ace.
 java.lang.String getCurrentScore(int cardIndex)
          Returns a displayable current score (or "busted" if this hand has busted), not including cards beyond the specified index.
private  DealerHandEventListenerCollection getDealerHandEventListenerCollection()
          Returns the event listener collection for this dealer hand.
protected  java.lang.String getTotalLabel()
          Returns the prefix for the current score label (for example, "Score:").
 boolean isWaitingForPlayer()
          Indicates whether this dealer hand is currently waiting for the player to finish.
 boolean shouldHit()
          Indicates whether the dealer should hit this hand.
 
Methods inherited from class com.amoebacode.blackjack.core.Hand
addCard, clear, getBestTotal, getBestTotal, getHandEventListenerCollection, getHardTotal, getHardTotal, getHouseRules, getMaximumSafeHitScore, getRound, getSoftTotal, getSoftTotal, hasBlackjack, hasBusted, hasMaximumNumberOfCards, hasMaximumScore, hasPair, hasSoftTotal, hit, shouldUseMixedTotal
 
Methods inherited from class com.amoebacode.blackjack.core.CardCollection
getCardAt, getNextCard, getNumberOfCards, setCards
 
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.IHand
clear, getBestTotal, getBestTotal, getHardTotal, getSoftTotal, hasBlackjack, hasBusted, hasPair, hasSoftTotal, hit
 
Methods inherited from interface com.amoebacode.blackjack.core.ICardCollection
addCard, getCardAt, getNextCard, getNumberOfCards, setCards
 
Methods inherited from interface com.amoebacode.blackjack.core.IGameObject
addEventListener, getGame, getParent
 

Field Detail

isWaitingForPlayer

private boolean isWaitingForPlayer
Indicates whether the player hands have completed
Constructor Detail

DealerHand

protected DealerHand(IDealer dealer)
Default public constructor.
Parameters:
dealer - the IDealer managing this hand
Method Detail

firstCardIsAce

public boolean firstCardIsAce()
Description copied from interface: IDealerHand
Indicates whether the first card in this hand is an ace.
Specified by:
firstCardIsAce in interface IDealerHand
See Also:
IDealerHand.firstCardIsAce()

shouldHit

public boolean shouldHit()
Description copied from interface: IDealerHand
Indicates whether the dealer should hit this hand.
Specified by:
shouldHit in interface IDealerHand
See Also:
IDealerHand.shouldHit()

getCurrentScore

public java.lang.String getCurrentScore(int cardIndex)
Description copied from interface: IHand
Returns a displayable current score (or "busted" if this hand has busted), not including cards beyond the specified index.
Specified by:
getCurrentScore in interface IHand
Overrides:
getCurrentScore in class Hand
See Also:
IHand.getCurrentScore(int)

assumeControl

public void assumeControl()
Description copied from interface: IDealerHand
Turns over the face-down card and notifies the GUI listeners (called when all of the player hands have finished).
Specified by:
assumeControl in interface IDealerHand
See Also:
IDealerHand.assumeControl()

isWaitingForPlayer

public boolean isWaitingForPlayer()
Description copied from interface: IDealerHand
Indicates whether this dealer hand is currently waiting for the player to finish.
Specified by:
isWaitingForPlayer in interface IDealerHand
See Also:
IDealerHand.isWaitingForPlayer()

getTotalLabel

protected java.lang.String getTotalLabel()
Description copied from class: Hand
Returns the prefix for the current score label (for example, "Score:").
Overrides:
getTotalLabel in class Hand
See Also:
Hand.getTotalLabel()

getDealerHandEventListenerCollection

private DealerHandEventListenerCollection getDealerHandEventListenerCollection()
Returns the event listener collection for this dealer hand.
Returns:
this object's DealerHandEventListenerCollection

Blackjack

Copyright © 2002 amoebacode.com.