|
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Deck
Represents a deck of playing cards. In order to have maximum flexibility, this class does not implement a standard deck of playing cards; it only provides the functionality of a deck of cards. The client programmer must instantiate a Deck object, then populate it with the set of playing cards appropriate for the card game being implemented. This allows for proper implementation of card games such as pinochle (a 48-card deck containing only aces, nines, tens, jacks, queens, and kings in all four suits, with each card present twice in the deck) or casino-style blackjack (where six standard decks are used for a game).
Constructor Summary | |
Deck()
Creates an empty deck of cards. |
Method Summary | |
void |
addCard(Card card)
Adds a card to the deck. |
Card |
dealCard()
Deal one card from the deck. |
int |
getNumberOfCardsRemaining()
The number of cards left in the deck. |
int |
getSizeOfDeck()
The size of a deck of cards. |
boolean |
isEmpty()
Looks for an empty deck. |
void |
restoreDeck()
Restores the deck to "full deck" status. |
void |
shuffle()
Shuffles the cards present in the deck. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Deck()
Method Detail |
public void addCard(Card card)
card
- card to be added to the deck.public int getSizeOfDeck()
public int getNumberOfCardsRemaining()
public Card dealCard()
public void shuffle()
public boolean isEmpty()
true
if there are no cards left to be dealt from the deck.public void restoreDeck()
|
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |