org.eclipse.lifegame.domain
Class Game

java.lang.Object
  |
  +--org.eclipse.lifegame.domain.Game
Direct Known Subclasses:
TwoDimensionalGame

public abstract class Game
extends java.lang.Object

Author:
Espirity Inc.

Constructor Summary
Game()
          Default constructor for Game.
 
Method Summary
 void addToHistory(Board aBoard)
          Add aBoard to the game's board history.
 void clearHistory()
          Removes receiver's history, clears the collection of boards.
 Board getBoard()
          Return receiver's board.
 java.util.ArrayList getBoardHistory()
          Return collection of boards, a history.
 int getGeneration()
          Return generations for teh game.
 Rule[] getRules()
          Return game rules.
 void loadBoardFromFile(java.lang.String filename)
          Loads receiver's board from a given file and assigns it to the receiver.
 void printHistory()
          Prints receiver's board history to standard output.
 void run()
          Runs the game.
 void saveCurrentBoardToFile(java.lang.String filename)
          Saves receiver's board to a given file.
 void setBoard(Board board)
          Set the receiver's board.
 void setBoardHistory(java.util.ArrayList list)
          Set game's board history.
 void setGeneration(int i)
          Set game's generations.
 void setRules(Rule[] rules)
          Set the game rules.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Game

public Game()
Default constructor for Game.
Method Detail

getBoard

public Board getBoard()
Return receiver's board.
Returns:
receiver's board, an instance of Board class

setBoard

public void setBoard(Board board)
Set the receiver's board.
Parameters:
an - instance of Board class

getRules

public Rule[] getRules()
Return game rules.
Returns:
array of Rule objects

setRules

public void setRules(Rule[] rules)
Set the game rules.
Parameters:
an - array of Rule objects

run

public void run()
Runs the game.

getGeneration

public int getGeneration()
Return generations for teh game.
Returns:
integer

setGeneration

public void setGeneration(int i)
Set game's generations.
Parameters:
i, - integer

getBoardHistory

public java.util.ArrayList getBoardHistory()
Return collection of boards, a history.
Returns:
a collection

setBoardHistory

public void setBoardHistory(java.util.ArrayList list)
Set game's board history.
Parameters:
list - collection of boards

addToHistory

public void addToHistory(Board aBoard)
Add aBoard to the game's board history.
Parameters:
an - instance of Board class

clearHistory

public void clearHistory()
Removes receiver's history, clears the collection of boards.

printHistory

public void printHistory()
Prints receiver's board history to standard output.

saveCurrentBoardToFile

public void saveCurrentBoardToFile(java.lang.String filename)
Saves receiver's board to a given file.

loadBoardFromFile

public void loadBoardFromFile(java.lang.String filename)
Loads receiver's board from a given file and assigns it to the receiver.