|
-footer | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgarrettsmith.playingcards.StandardDeck
public class StandardDeck
Represents a standard deck of 52 playing cards.
This class is not thread safe.
This deck contains 13 cards (two through ten, Jack, Queen, King, and Ace) in 4 suits (diamonds, hearts, spades, and clubs). It has no jokers.
| Field Summary | |
|---|---|
static StandardDeck |
DECK
Singleton instance of this immutable deck. |
| Method Summary | |
|---|---|
java.util.List |
getAllCards()
Returns a nonrandom list of all 52 cards contained in a fresh deck. |
int |
getNumCardsOfType(Card.Color color)
Returns the number of cards in the deck whose color is equal to color. |
int |
getNumCardsOfType(Card.Suit suit)
Returns the number of cards in the deck whose suit is equal to suite. |
int |
getNumCardsOfType(Card.Value value)
Returns the number of cards in the deck whose value is equal to value. |
int |
size()
Returns the number of cards in this deck: 52 for this specific deck. |
java.lang.String |
toString()
Returns a string representation of this deck. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final StandardDeck DECK
| Method Detail |
|---|
public java.util.List getAllCards()
getAllCards in interface Deckpublic int size()
size in interface Deckpublic java.lang.String toString()
toString in class java.lang.Objectpublic int getNumCardsOfType(Card.Color color)
color.
getNumCardsOfType in interface Deckpublic int getNumCardsOfType(Card.Suit suit)
suite.
getNumCardsOfType in interface Deckpublic int getNumCardsOfType(Card.Value value)
value.
getNumCardsOfType in interface Deck
|
-footer | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||