cardDeck
Class DeckOfCards

java.lang.Object
  extended by cardDeck.CardPile
      extended by cardDeck.DeckOfCards
All Implemented Interfaces:
java.lang.Iterable<Card>

public class DeckOfCards
extends CardPile

The deck of cards to be used for a game.

Version:
0.5
Author:
Devin Ryan

Constructor Summary
DeckOfCards(int useXJokers)
          Constructor
 
Method Summary
 Card deal()
          Deals out one card
 java.util.ArrayList<Card> deal(int n)
          Deals out the appropriate number of cards.
 void newRound()
          Shuffle all cards into the deck Pre: All cards have been discarded as this will create a whole new deck, so if hands, discard piles, etc exist clear them first to insure no duplicates.
 boolean rulesAllowAddingThisCard(Card card)
          Subclasses may override this to enforce their rules for adding cards to the pile.
 
Methods inherited from class cardDeck.CardPile
clear, isRemovable, iterator, peekTop, pop, popIgnoreRules, push, pushIgnoreRules, reverseIterator, shuffle, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeckOfCards

public DeckOfCards(int useXJokers)
Constructor

Parameters:
useXJokers - Number of jokers to use in this deck
Method Detail

newRound

public void newRound()
Shuffle all cards into the deck Pre: All cards have been discarded as this will create a whole new deck, so if hands, discard piles, etc exist clear them first to insure no duplicates.


rulesAllowAddingThisCard

public boolean rulesAllowAddingThisCard(Card card)
Subclasses may override this to enforce their rules for adding cards to the pile.

Overrides:
rulesAllowAddingThisCard in class CardPile
Parameters:
card - Card to be added.
Returns:
False, since can't add a card back which was picked from main deck

deal

public Card deal()
Deals out one card

Returns:
Card on top of the deck

deal

public java.util.ArrayList<Card> deal(int n)
Deals out the appropriate number of cards. Pre: n cards remain in the deck.

Parameters:
n - Number of cards to deal out
Returns:
ArrayList of cards that were dealt.