Class Foundation

java.lang.Object
  extended by CardPile
      extended by Foundation
All Implemented Interfaces:
ICardPile, IGuiPileModel

public class Foundation
extends CardPile

Foundation object, which holds a pile of cards, in order of increasing rank.

The extension of CardPile makes the class easier because now you can call all those methods without redoing all other methods

Author:
Group 6
ab68 Arup Banerjee
rau Robert Buechler
pp25 Patrick Paczkowski
orl Oriana Lisker

Constructor Summary
Foundation()
           
 
Method Summary
 IGuiCard getVisibleCard(int index)
          This method returns the top card of the foundation because only that card can ever be visible.
 boolean isAddable(Card card)
          Overrides default isAddable method
 boolean isRemovable(Card card)
          Overrides default isRemovable method Returns false, since you cannot remove from a foundation
static void main(java.lang.String[] args)
          Main method, checks whether there are bugs in class
 int maxVisibleCount()
          A foundation can only have 1 card visible at most.
 int visibleCardCount()
          A foundation has zero cards visible if it is empty, 1 if it is not.
 
Methods inherited from class CardPile
addCard, clear, dealCard, forceAddCard, getCard, getMaxSize, getPileID, getSize, getSuit, isEmpty, isFull, isRemovable, isSameSuit, removeCard, setID, setMaxSize, setSuit, setView, update
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Foundation

public Foundation()
Method Detail

isAddable

public boolean isAddable(Card card)
Overrides default isAddable method

Specified by:
isAddable in interface ICardPile
Overrides:
isAddable in class CardPile
Parameters:
card - - card to be added to the Foundation
Returns:
true if myPile is empty and myRank(card) returns 1 or if myPile is not full and myRank(card) returns one greater than getHighCard

isRemovable

public boolean isRemovable(Card card)
Overrides default isRemovable method Returns false, since you cannot remove from a foundation

Returns:
false

main

public static void main(java.lang.String[] args)
Main method, checks whether there are bugs in class


maxVisibleCount

public int maxVisibleCount()
A foundation can only have 1 card visible at most.

Specified by:
maxVisibleCount in interface IGuiPileModel
Overrides:
maxVisibleCount in class CardPile
Returns:
the max number of visible cards in the foundation

visibleCardCount

public int visibleCardCount()
A foundation has zero cards visible if it is empty, 1 if it is not.

Specified by:
visibleCardCount in interface IGuiPileModel
Overrides:
visibleCardCount in class CardPile
Returns:
the number of visible cards in the foundation

getVisibleCard

public IGuiCard getVisibleCard(int index)
This method returns the top card of the foundation because only that card can ever be visible.

Specified by:
getVisibleCard in interface IGuiPileModel
Overrides:
getVisibleCard in class CardPile
Parameters:
index - specifies which visible card obtained from model
Returns:
the visible card in the foundation