com.amoebacode.blackjack.core
Class Deck
java.lang.Object
|
+--com.amoebacode.blackjack.core.GameObject
|
+--com.amoebacode.blackjack.core.CardCollection
|
+--com.amoebacode.blackjack.core.Deck
- All Implemented Interfaces:
- ICardCollection, IDeck, IGameObject
- class Deck
- extends CardCollection
- implements IDeck
Deck manages the collection of cards in the shoe that is waiting to be dealt.
- Version:
- 0.9
- Author:
- Jason Gurney
|
Constructor Summary |
protected |
Deck(IGame game)
Default protected constructor. |
|
Method Summary |
private DeckEventListenerCollection |
getDeckListenerCollection()
Returns the event listener collection for this deck. |
Card |
getNextCard()
Removes and returns the first card in this collection and notifies the GUI listeners. |
double |
getNumberOfDecks()
Returns the current number of decks remaining, rounded to the nearest
half-deck. |
void |
setCards(java.util.List cards)
Sets the list of cards appearing in this collection and notifies the GUI listeners. |
boolean |
shouldShuffle()
Indicates whether this deck should be shuffled before beginning the next
round. |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
FEWEST_NUMBER_OF_CARDS
private static final int FEWEST_NUMBER_OF_CARDS
- The minimum number of cards needed to start a round
CARDS_IN_DECK
private static final int CARDS_IN_DECK
- The number of cards in each deck
Deck
protected Deck(IGame game)
- Default protected constructor.
- Parameters:
game - the main IGame object
getNumberOfDecks
public double getNumberOfDecks()
- Description copied from interface:
IDeck
- Returns the current number of decks remaining, rounded to the nearest
half-deck.
- Specified by:
getNumberOfDecks in interface IDeck
- See Also:
IDeck.getNumberOfDecks()
shouldShuffle
public boolean shouldShuffle()
- Description copied from interface:
IDeck
- Indicates whether this deck should be shuffled before beginning the next
round.
- Specified by:
shouldShuffle in interface IDeck
- See Also:
IDeck.shouldShuffle()
getNextCard
public Card getNextCard()
- Description copied from interface:
ICardCollection
- Removes and returns the first card in this collection and notifies the GUI listeners.
- Specified by:
getNextCard in interface ICardCollection- Overrides:
getNextCard in class CardCollection
- See Also:
ICardCollection.getNextCard()
setCards
public void setCards(java.util.List cards)
- Description copied from interface:
ICardCollection
- Sets the list of cards appearing in this collection and notifies the GUI listeners.
- Specified by:
setCards in interface ICardCollection- Overrides:
setCards in class CardCollection
- See Also:
ICardCollection.setCards(List)
getDeckListenerCollection
private DeckEventListenerCollection getDeckListenerCollection()
- Returns the event listener collection for this deck.
- Returns:
- this object's DeckEventListenerCollection
Copyright © 2002 amoebacode.com.