Class Printer

java.lang.Object
  extended by Printer
All Implemented Interfaces:
IView

public class Printer
extends java.lang.Object
implements IView


Constructor Summary
Printer()
           
 
Method Summary
 void getNextMove()
          This method handles the input of new moves for the text-based program.
 void makeMove()
          Keeps inputting moves from console, until it is given a valid move, in which case the move is performed
 void printAll()
          Prints state of Freecell board
 void printCard(Card c)
          Prints card c, by first converting it into a string
 void printCellHeader()
          Prints header for cells
 void printCells()
          Prints cards contained in cells
 void printEmpty()
          Prints empty spot (with no card)
 void printEnd()
          Prints end of game message
 void printEndl()
          Prints an endline
 void printFoundations()
          Prints highest cards in Foundations
 void printFoundHeader()
          Prints header for Foundations
 void printMoveQuery()
          Asks user to input where he wants to move cards from/to
 void printNumOfCardsQuery()
          Asks user how many cards he wishes to move
 void printPlayAgainQuery()
          Asks user if he/she wants to play again
 void printSeparator()
          Prints a separator
 void printShorterTabSep()
          Prints a shorter tab separator (after a 10* card)
 void printTableauHeader()
          Prints header for tableaus
 void printTabSep()
          Prints a tab separator
 void printTitle()
          prints the title of the game
 void setFreecell(Freecell f)
          This method associated the printer object with a freecell game f.
 void showError()
          Prints error message when invalid move is entered
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Printer

public Printer()
Method Detail

setFreecell

public void setFreecell(Freecell f)
This method associated the printer object with a freecell game f. It also tells each of the pile models to set its view to a new TextPileView.

Specified by:
setFreecell in interface IView
Parameters:
f - the freecell object to be linked to this view

printAll

public void printAll()
Prints state of Freecell board

Specified by:
printAll in interface IView

printFoundHeader

public void printFoundHeader()
Prints header for Foundations


printFoundations

public void printFoundations()
Prints highest cards in Foundations


printCellHeader

public void printCellHeader()
Prints header for cells


printCells

public void printCells()
Prints cards contained in cells


printTableauHeader

public void printTableauHeader()
Prints header for tableaus


printCard

public void printCard(Card c)
Prints card c, by first converting it into a string


printTitle

public void printTitle()
Description copied from interface: IView
prints the title of the game

Specified by:
printTitle in interface IView

printMoveQuery

public void printMoveQuery()
Asks user to input where he wants to move cards from/to


printNumOfCardsQuery

public void printNumOfCardsQuery()
Asks user how many cards he wishes to move


printEnd

public void printEnd()
Description copied from interface: IView
Prints end of game message

Specified by:
printEnd in interface IView

printPlayAgainQuery

public void printPlayAgainQuery()
Description copied from interface: IView
Asks user if he/she wants to play again

Specified by:
printPlayAgainQuery in interface IView

printSeparator

public void printSeparator()
Prints a separator


printTabSep

public void printTabSep()
Prints a tab separator


printShorterTabSep

public void printShorterTabSep()
Prints a shorter tab separator (after a 10* card)


printEndl

public void printEndl()
Prints an endline


printEmpty

public void printEmpty()
Prints empty spot (with no card)


showError

public void showError()
Prints error message when invalid move is entered

Specified by:
showError in interface IView

makeMove

public void makeMove()
Keeps inputting moves from console, until it is given a valid move, in which case the move is performed

Specified by:
makeMove in interface IView

getNextMove

public void getNextMove()
This method handles the input of new moves for the text-based program. It loops until the game is over, checking for foundation cards to move after each move and also checking to see if the game has ended. If the user inputs the new game sequence as a move or wants to play a new game after the current one has ended, then it tells Freecell to start a new game.

Specified by:
getNextMove in interface IView