The Deck class

with information from lecture filled in (in red)

UML diagram

Deck
-cards:Card[]
-cardsInDeck:int
+DECK_SIZE:int
+Deck()
+deal():Card
+deal(int):Card[]
+shuffle():void
+reset():void
+toString():String

Source code links

Selected public methods

deal

/**
 * Deals one card from the deck, decreasing the number of cards in the 
 * deck by one.
 * 
 * @return the next Card object in the deck; null if deck is empty
 */
public Card deal() {
    if (cardsInDeck == 0)
        return null;
        
    cardsInDeck--;
    Card dealtCard = cards[cardsInDeck];
    cards[cardsInDeck] = null;
    return dealtCard;
}

shuffle

/**
 * Shuffles the deck (i.e. randomly reorders the cards in the deck). 
 */
public void shuffle() {



























}

reset

/**
 * Resets the deck so that it has all its cards. Note that the order of 
 * the cards may be random.
 */
public void reset() {







}