view.gui
Class GraphicUI

java.lang.Object
  extended by view.gui.GraphicUI
All Implemented Interfaces:
UserInterface

public class GraphicUI
extends java.lang.Object
implements UserInterface

Provides a window portrait of the game.


Constructor Summary
GraphicUI()
          constructor: Creates a new Window with an initialized chess board.
 
Method Summary
 boolean makeMove(Cell a, Cell b)
          transformer(mutative): Executes the move which is provided by the parameter integers which define two cells,a source and a destination one.
 void nextGame()
          transformer(mutative): Changes the chess board of the game to show to a next board.
 void previousGame()
          transformer(mutative): Changes the chess board of the game to show to a previous move.
 void showGame()
          accessor(selector): Displays the current game.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphicUI

public GraphicUI()
constructor: Creates a new Window with an initialized chess board.
postconditions: Creates a new window with a board on it, starting a new game.

Method Detail

showGame

public void showGame()
accessor(selector): Displays the current game.
postcondition: Visualize on window environment the game.

Specified by:
showGame in interface UserInterface

makeMove

public boolean makeMove(Cell a,
                        Cell b)
transformer(mutative): Executes the move which is provided by the parameter integers which define two cells,a source and a destination one.
postconditions: Runs the move which is defined by the parameter integers. Returns true if move is successfully executed, false otherwise.

Specified by:
makeMove in interface UserInterface
Parameters:
a - source Cell
b - destination Cell
Returns:
true if move is executed, false otherwise.

nextGame

public void nextGame()
              throws IllegalViewException
transformer(mutative): Changes the chess board of the game to show to a next board.
preconditions: Before invoking this method, previousGame() has been invoked and has changed the chess board.
postconditions: The game now shows to one state after where the prevGame() has taken us.

Specified by:
nextGame in interface UserInterface
Throws:
IllegalViewException - When there is no next board to go.

previousGame

public void previousGame()
                  throws IllegalViewException
transformer(mutative): Changes the chess board of the game to show to a previous move.
preconditions: Before invoking this method, there is at least one move done in the board. postconditions: If current game is at the beginning , the board will be changed, showing the previous state of it.

Specified by:
previousGame in interface UserInterface
Throws:
IllegalViewException - When there is no previous board to go.