com.gbayer.basicblackjack
Class Card

java.lang.Object
  extended by com.gbayer.basicblackjack.Card

public class Card
extends java.lang.Object

A Card within a Deck or a Hand


Field Summary
static int ACE_ID
          Constant - Card id representing an ace.
static int FACE_CARD_VALUE
          Constant - Value of any face card.
static int FIRST_FACE_CARD_ID
          Constant - All cards with ids equal or greater are face cards.
static int HIGH_ACE_VALUE
          Constant - High value of an ace.
static int JACK_ID
          Constant - Card id representing an jack.
static int KING_ID
          Constant - Card id representing an king.
static int LOW_ACE_VALUE
          Constant - Low value of an ace.
static int MAX_CARD_ID
          Constant - Number of unique card ids.
static int QUEEN_ID
          Constant - Card id representing an queen.
 
Constructor Summary
Card(int card)
          Instantiates a new card.
 
Method Summary
 int getCardValue(boolean acesLow)
          Gets the card's value.
 java.lang.String toString()
          Generates character representation of card.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FACE_CARD_VALUE

public static final int FACE_CARD_VALUE
Constant - Value of any face card.

See Also:
Constant Field Values

LOW_ACE_VALUE

public static final int LOW_ACE_VALUE
Constant - Low value of an ace.

See Also:
Constant Field Values

HIGH_ACE_VALUE

public static final int HIGH_ACE_VALUE
Constant - High value of an ace.

See Also:
Constant Field Values

ACE_ID

public static final int ACE_ID
Constant - Card id representing an ace.

See Also:
Constant Field Values

JACK_ID

public static final int JACK_ID
Constant - Card id representing an jack.

See Also:
Constant Field Values

QUEEN_ID

public static final int QUEEN_ID
Constant - Card id representing an queen.

See Also:
Constant Field Values

KING_ID

public static final int KING_ID
Constant - Card id representing an king.

See Also:
Constant Field Values

FIRST_FACE_CARD_ID

public static final int FIRST_FACE_CARD_ID
Constant - All cards with ids equal or greater are face cards.

See Also:
Constant Field Values

MAX_CARD_ID

public static final int MAX_CARD_ID
Constant - Number of unique card ids.

See Also:
Constant Field Values
Constructor Detail

Card

public Card(int card)
Instantiates a new card.

Parameters:
card - the card
Method Detail

getCardValue

public int getCardValue(boolean acesLow)
Gets the card's value.

Parameters:
acesLow - indicates whether to treat an ace's as value 1 or 11)
Returns:
the card value

toString

public java.lang.String toString()
Generates character representation of card.

Overrides:
toString in class java.lang.Object
Returns:
character representation of card