|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectTableauPiles
public class TableauPiles
This class is responsible for holding the tableaus and manipulating them by acting as a middleman between the Freecell class and the Tableau class. Most methods merely tell the specific tableaus to perform a certain function. This class also is responsible for creating a 2-D array of the tableaus that represents the board so that the class responsible for output can print it to the screen in some form.
| Field Summary | |
|---|---|
static int |
NUM_TABLEAUS
|
| Constructor Summary | |
|---|---|
TableauPiles()
Constructs a TableauPiles object that represents the board by holding each tableau in an ArrayList |
|
| Method Summary | |
|---|---|
boolean |
addCard(Card card,
int destinationTab)
Tells tableau destinationTab to add a new card to itself. |
void |
clear()
Clears all of the tableaus. |
boolean |
deal1Card(Card newCard,
int i)
Adds card to the ith tableau when dealing |
boolean |
forceAddlCard(Card card,
int destinationTab)
Tells tableau destinationTab to add a new card to itself. |
Card |
getCard(int numTab)
Returns the last card in Tableau numTab. |
CardPile |
getTableau(int num)
Accesses the num(th) tableau in the array. |
Card[][] |
getTableaus()
Creates a 2-D array of the tableaus. |
int[] |
getTableauSizes()
Creates an array containing the size of each tableau at its respective index. |
static void |
main(java.lang.String[] args)
Main method, checks whether there are bugs in class |
void |
makeTemp(int tabNum,
int numCards)
Uses an instance variable to create a temporary stack of size numCards from Tableau numTab. |
boolean |
moveCard(int origin,
int destination,
int max)
Moves the last card in tableau origin to tableau destination. |
int |
numMovable(int origin,
int destination,
int max)
Checks to see how many, if any, cards can be moved from origin tableau to destination tableau |
void |
recreateFromTemp(int tabNum,
int numCards)
Removes the cards from the temporary stack and places them in Tableau numTab. |
Card |
removeCard(int numTab)
Tells Tableau numTab to remove its last card and returns it. |
void |
update()
Tell each of the Tableau pile models to update itself. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int NUM_TABLEAUS
| Constructor Detail |
|---|
public TableauPiles()
| Method Detail |
|---|
public boolean moveCard(int origin,
int destination,
int max)
origin - the number of the tableau where the card to be moved is locateddestination - the number of the tableau to where the card will be movedmax - is the maximum number of cards that can be moved
based on the number of free cells
public CardPile getTableau(int num)
num - the index of the tableau to be retrieved
public boolean forceAddlCard(Card card,
int destinationTab)
card - the Card to be addeddestinationTab - the tableau where it will be added
public boolean addCard(Card card,
int destinationTab)
card - the Card to be addeddestinationTab - the tableau where it will be added
public Card removeCard(int numTab)
numTab - the Tableau number to remove a card from
public Card getCard(int numTab)
numTab - the Tableau to get a card from
public void clear()
public void update()
public Card[][] getTableaus()
public int[] getTableauSizes()
public void makeTemp(int tabNum,
int numCards)
numTab - the Tableau in which it is desired to see the cardsnumCards - the number of cards to be put into the temporary stack for viewing
public void recreateFromTemp(int tabNum,
int numCards)
numTab - the Tableau which the cards are put intonumCards - the number of cards to put back into the Tableau. This is not
necessarily the size of the stack - one might want to view each card individually
before it is put back in the Tableau.
public int numMovable(int origin,
int destination,
int max)
origin - is the tableau from which the cards are to be moveddestination - is the index of the destination tableaumax - is the maximum number of cards that can be moved
based on the number of free cells
public static void main(java.lang.String[] args)
public boolean deal1Card(Card newCard,
int i)
newCard - the card to deali - the number of the tableau to deal on to
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||