Class FoundationPiles

java.lang.Object
  extended by FoundationPiles

public class FoundationPiles
extends java.lang.Object

This class manages Foundations via an array of four Foundation objects. All the other classes need to use are the constructor, clear (to restart the game) and addCard.

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

Field Summary
static int NUM_FOUNDATIONS
           
 
Constructor Summary
FoundationPiles()
          default Constructor - makes an array of 4 Foundations with arbitrarily assigned suits
 
Method Summary
 boolean addCard(Card card)
          Method which adds card to corresponding foundation
 boolean allComplete()
          Method for determining whether all foundations are complete
 void clear()
          Method for starting a new game.
 Foundation getFoundation(int num)
          Returns requested foundation
 java.util.ArrayList<Card> getHighCards()
          Method which returns the high cards of the four foundations
 java.lang.String getSuit(int num)
          Returns suit of foundation with index num
 boolean isAddable(Card card)
          Method for determining whether card can be added to a foundation
 boolean isCardMovableToFound(Card toMove)
          Checks if card toMove can be automatically moved to foundation
static void main(java.lang.String[] args)
          Main method, checks whether there are bugs in class
 void update()
          Tells the view for each foundation model to update itself.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NUM_FOUNDATIONS

public static final int NUM_FOUNDATIONS
See Also:
Constant Field Values
Constructor Detail

FoundationPiles

public FoundationPiles()
default Constructor - makes an array of 4 Foundations with arbitrarily assigned suits

Method Detail

clear

public void clear()
Method for starting a new game. Clears the Foundation piles.


getFoundation

public Foundation getFoundation(int num)
Returns requested foundation

Returns:
foundation in myFoundations corresponding to num

isAddable

public boolean isAddable(Card card)
Method for determining whether card can be added to a foundation

Returns:
true if card can be added to any of the foundations, false otherwise

allComplete

public boolean allComplete()
Method for determining whether all foundations are complete

Returns:
true if all foundations are complete; false otherwise

addCard

public boolean addCard(Card card)
Method which adds card to corresponding foundation

Returns:
true if card was added successfully; false otherwise

getHighCards

public java.util.ArrayList<Card> getHighCards()
Method which returns the high cards of the four foundations

Returns:
ArrayList containing four high cards corresponding to each foundation

isCardMovableToFound

public boolean isCardMovableToFound(Card toMove)
Checks if card toMove can be automatically moved to foundation

Parameters:
toMove - is card to be moved
Returns:
true if card can be moved; false otherwise

getSuit

public java.lang.String getSuit(int num)
Returns suit of foundation with index num

Returns:
suit of foundation num

update

public void update()
Tells the view for each foundation model to update itself.


main

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