Blackjack

com.amoebacode.blackjack.core
Class CardCollection

java.lang.Object
  |
  +--com.amoebacode.blackjack.core.GameObject
        |
        +--com.amoebacode.blackjack.core.CardCollection
All Implemented Interfaces:
ICardCollection, IGameObject
Direct Known Subclasses:
Deck, Hand

abstract class CardCollection
extends GameObject
implements ICardCollection

CardCollection is the base class for all sets of cards (like Deck and Hand).

Version:
0.9
Author:
Jason Gurney

Field Summary
private  java.util.List cards
          The list of cards in this collection
 
Fields inherited from class com.amoebacode.blackjack.core.GameObject
listeners, parent
 
Constructor Summary
protected CardCollection(IGameObject gameObject)
          Default protected constructor.
 
Method Summary
 void addCard(ICard card)
          Adds the specified card to this collection and notifies the GUI listeners.
 Card getCardAt(int index)
          Returns the card at the specified index.
 Card getNextCard()
          Removes and returns the first card in this collection and notifies the GUI listeners.
 int getNumberOfCards()
          Returns the number of cards in this collection.
 void setCards(java.util.List cards)
          Sets the list of cards appearing in this collection and notifies the GUI listeners.
 
Methods inherited from class com.amoebacode.blackjack.core.GameObject
addEventListener, getEventListenerCollection, getGame, getParent, hasParent, setEventListenerCollection
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 
Methods inherited from interface com.amoebacode.blackjack.core.IGameObject
addEventListener, getGame, getParent
 

Field Detail

cards

private java.util.List cards
The list of cards in this collection
Constructor Detail

CardCollection

protected CardCollection(IGameObject gameObject)
Default protected constructor.
Parameters:
gameObject - the parent of this collection
Method Detail

getNumberOfCards

public int getNumberOfCards()
Description copied from interface: ICardCollection
Returns the number of cards in this collection.
Specified by:
getNumberOfCards in interface ICardCollection
See Also:
ICardCollection.getNumberOfCards()

getCardAt

public Card getCardAt(int index)
Description copied from interface: ICardCollection
Returns the card at the specified index.
Specified by:
getCardAt in interface ICardCollection
See Also:
ICardCollection.getCardAt(int)

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
See Also:
ICardCollection.getNextCard()

addCard

public void addCard(ICard card)
Description copied from interface: ICardCollection
Adds the specified card to this collection and notifies the GUI listeners.
Specified by:
addCard in interface ICardCollection
See Also:
ICardCollection.addCard(ICard)

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
See Also:
ICardCollection.setCards(List)

Blackjack

Copyright © 2002 amoebacode.com.