|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectDeck
Constructor Summary | |
Deck()
Constructs an empty deck of cards. |
|
Deck(int capacity)
Constructs an empty deck of cards with a given capacity. |
Method Summary | |
void |
add(Card card)
Adds a given card at the top of this deck. |
int |
getNumCards()
Returns the number of cards in this deck. |
boolean |
isEmpty()
Indicates whether this deck is empty. |
void |
shuffle()
Shuffles this deck. |
void |
sort()
Sorts this deck in acsending order of IDs. |
Card |
takeTop()
Removes and returns the top card from this 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 |
Constructor Detail |
public Deck()
public Deck(int capacity)
capacity
- the number of cards this deck can hold
without expanding the ArrayList that holds the cards.Method Detail |
public int getNumCards()
public boolean isEmpty()
public void add(Card card)
card
- to be added.public Card takeTop()
java.util.NoSuchElementException
- if this deck is empty.public void shuffle()
public void sort()
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |