|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--StandardDeck
models a standard 52 card deck.
Cards can be taken from the deck.
The only way to add cards to the deck is by
resetting the deck.
class invariants:
-1 <= myTopCardIndex < MAX_CARDS
| Field Summary | |
static int |
MAX_CARDS
|
| Constructor Summary | |
StandardDeck()
pre: none post: deck created, with 52 cards, |
|
| Method Summary | |
Card |
deal()
A mutator that returns a value. |
boolean |
isEmpty()
pre: none post: returns true iff numCardsInDeck = 0 |
int |
numCardsInDeck()
pre: none; post: returns number of cards left in logical deck |
void |
reset()
pre: none post: deck reset to 52 cards and shuffled |
void |
shuffle()
pre: none post: deck shuffled. |
String |
toString()
pre: none post: return a String version of the Cards left in the deck |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int MAX_CARDS
| Constructor Detail |
public StandardDeck()
| Method Detail |
public Card deal()
public boolean isEmpty()
public int numCardsInDeck()
public void reset()
public void shuffle()
public String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||