com.blackledge.david.game.solitaire
Class SolitaireGoalStack

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.Vector
              extended by com.blackledge.david.game.solitaire.CardStack
                  extended by com.blackledge.david.game.solitaire.SolitaireGoalStack
All Implemented Interfaces:
Serializable, Cloneable, Iterable, Collection, List, RandomAccess

public class SolitaireGoalStack
extends CardStack

A CardStack used as a goal location in Solitaire

Version:
$Revision: 1.1 $
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
SolitaireGoalStack()
           
SolitaireGoalStack(Collection list)
           
 
Method Summary
 boolean canPickUp(int i)
          Determine if we are allowed to call CardStack.pickUp(int) without getting a null back.
 boolean canStack(Card card)
          Override for stacks with rules.
 boolean canStack(CardStack handStack)
           
 
Methods inherited from class com.blackledge.david.game.solitaire.CardStack
add, bottomCard, getReverse, pickUp, topCard
 
Methods inherited from class java.util.Vector
add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Constructor Detail

SolitaireGoalStack

public SolitaireGoalStack()

SolitaireGoalStack

public SolitaireGoalStack(Collection list)
Method Detail

canStack

public boolean canStack(CardStack handStack)
Overrides:
canStack in class CardStack
Parameters:
handStack - the stack that wants to be stacked on top of this instance.
Returns:
true if the handStack has only 1 card and canStack(Card).

canStack

public boolean canStack(Card card)
Description copied from class: CardStack
Override for stacks with rules.

Overrides:
canStack in class CardStack
Parameters:
card - the card that wants to be stacked on top of this instance.
Returns:
true if this stack is empty and the card is an Ace, or if the this stack's top card is the same suit as the card and has a value one less than the card.

canPickUp

public boolean canPickUp(int i)
Description copied from class: CardStack
Determine if we are allowed to call CardStack.pickUp(int) without getting a null back.

Overrides:
canPickUp in class CardStack
Returns:
true for i==0 (the top card) if this stack is not empty.