Blackjack

com.amoebacode.blackjack.core
Interface IHand

All Superinterfaces:
ICardCollection, IGameObject
All Known Subinterfaces:
IDealerHand, IPlayerHand
All Known Implementing Classes:
Hand

public interface IHand
extends ICardCollection

IHand defines the standard API for a hand of cards, including basic manipulation and score retrieval.

Version:
0.9
Author:
Jason Gurney

Method Summary
 void clear()
          Removes this hand from the table and notifies the GUI listeners.
 int getBestTotal()
          Returns the best score for this hand (the highest non-busting score).
 int getBestTotal(int cardIndex)
          Returns the best score for this hand (the highest non-busting score), not including cards beyond the specified index.
 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.
 int getHardTotal()
          Returns the hard score for this hand (the sum of all card hard scores).
 int getSoftTotal()
          Returns the soft score for this hand (the sum of all card soft scores).
 boolean hasBlackjack()
          Indicates whether this hand has blackjack.
 boolean hasBusted()
          Indicates whether this hand has busted.
 boolean hasPair()
          Indicates whether this hand contains a pair of matching scores.
 boolean hasSoftTotal()
          Indicates whether this hand has a soft total
 void hit()
          Adds a card from the deck to this hand and begins its animation.
 
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
 

Method Detail

getCurrentScore

public 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.
Parameters:
cardIndex - the last card in this hand to include in the score
Returns:
the displayable score

hasBusted

public boolean hasBusted()
Indicates whether this hand has busted.
Returns:
true if this hand has busted

hit

public void hit()
Adds a card from the deck to this hand and begins its animation.

hasBlackjack

public boolean hasBlackjack()
Indicates whether this hand has blackjack.
Returns:
true if this hand has blackjack

getBestTotal

public int getBestTotal()
Returns the best score for this hand (the highest non-busting score).
Returns:
the best total

getBestTotal

public int getBestTotal(int cardIndex)
Returns the best score for this hand (the highest non-busting score), not including cards beyond the specified index.
Parameters:
cardIndex - the last card in this hand to include in the score
Returns:
the best total

clear

public void clear()
Removes this hand from the table and notifies the GUI listeners.

hasPair

public boolean hasPair()
Indicates whether this hand contains a pair of matching scores.
Returns:
true if this hand contains a pair

getSoftTotal

public int getSoftTotal()
Returns the soft score for this hand (the sum of all card soft scores).
Returns:
the soft total

hasSoftTotal

public boolean hasSoftTotal()
Indicates whether this hand has a soft total
Returns:
true if this hand has a soft score

getHardTotal

public int getHardTotal()
Returns the hard score for this hand (the sum of all card hard scores).
Returns:
the hard total

Blackjack

Copyright © 2002 amoebacode.com.