solitaire.examples
Class Deck370

java.lang.Object
  extended by solitaire.examples.Deck370
All Implemented Interfaces:
java.util.Iterator<IGuiCard>

public class Deck370
extends java.lang.Object
implements java.util.Iterator<IGuiCard>

A Deck provides access to cards one-at-a-time using the Iterator interface from java.util. Objects returned from the iterator implement the IGuiCard interface. The Deck uses the simple GuiCard class from the freecell package. This class is for demo purposes in showing the GuiDemo, not as an example of how to design a deck class.


Field Summary
protected  java.util.ArrayList<GuiCard> myCardList
           
protected  int myIndex
           
 
Constructor Summary
Deck370()
          Construct a full deck in which the cards are shuffled.
 
Method Summary
 boolean hasNext()
          Returns true if this deck can deal more cards, false otherwise.
 GuiCard next()
          Return the next card in the deck (will throw an exception if there are no more cards).
 void remove()
          Required for the Iterator interface, not implemented.
protected  void shuffle()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myCardList

protected java.util.ArrayList<GuiCard> myCardList

myIndex

protected int myIndex
Constructor Detail

Deck370

public Deck370()
Construct a full deck in which the cards are shuffled.

Method Detail

shuffle

protected void shuffle()

hasNext

public boolean hasNext()
Returns true if this deck can deal more cards, false otherwise.

Specified by:
hasNext in interface java.util.Iterator<IGuiCard>
Returns:
true iff there are more cards in this deck.

next

public GuiCard next()
Return the next card in the deck (will throw an exception if there are no more cards).

Specified by:
next in interface java.util.Iterator<IGuiCard>
Returns:
the next Card in this deck.

remove

public void remove()
Required for the Iterator interface, not implemented.

Specified by:
remove in interface java.util.Iterator<IGuiCard>