com.eriksilkensen.sudoku
Class Board

java.lang.Object
  extended by com.eriksilkensen.sudoku.Board
All Implemented Interfaces:
java.io.Serializable

public class Board
extends java.lang.Object
implements java.io.Serializable

A Board represents a Sudoku game board which is composed with a 2D array of Cell objects.

Since:
1.0
Version:
02/13/07
Author:
Erik Silkensen
See Also:
Serialized Form

Constructor Summary
Board()
          Default constructor.
Board(Board other)
          Copy constructor
Board(Cell[][] cells, BoardDifficulties difficulty)
          Creates a Board with the supplied Cells and difficulty level
 
Method Summary
 Board clear()
          Clears the Board by resetting all of its Cells to value 0 and type Player
 boolean equals(java.lang.Object o)
          Determines the equality of this Board and another one
 Cell getCell(int row, int col)
          Gets the Cell at the location [row][col]
 Cell[][] getCells()
          Returns this Board's Cells
 java.lang.String getCellString(int row, int col)
          Returns the String representation of the Cell at location [row][col]
 BoardDifficulties getDifficulty()
          Returns this Board's difficulty
 int getID()
          Returns this Board's ID
 void printBoard()
          Prints out the Board
 Cell removeCell(int row, int col)
          Removes the Cell at the location [row][col] and returns it
 Board resetBoard(Board board)
          Resets the supplied Board and returns it
 void setCell(int row, int col, Cell cell)
          Sets the Cell at the location [row][col] to be 'cell'
 void setDifficulty(BoardDifficulties difficulty)
          Sets this Board's difficulty
 void setID(int ID)
          Sets this Board's ID
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Board

public Board()
Default constructor. Creates a board filled with Cells of value 0, type PLAYER, and difficulty Super Easy.


Board

public Board(Board other)
Copy constructor


Board

public Board(Cell[][] cells,
             BoardDifficulties difficulty)
Creates a Board with the supplied Cells and difficulty level

Method Detail

removeCell

public Cell removeCell(int row,
                       int col)
Removes the Cell at the location [row][col] and returns it


setCell

public void setCell(int row,
                    int col,
                    Cell cell)
Sets the Cell at the location [row][col] to be 'cell'


getCell

public Cell getCell(int row,
                    int col)
Gets the Cell at the location [row][col]


clear

public Board clear()
Clears the Board by resetting all of its Cells to value 0 and type Player


resetBoard

public Board resetBoard(Board board)
Resets the supplied Board and returns it


printBoard

public void printBoard()
Prints out the Board


getCellString

public java.lang.String getCellString(int row,
                                      int col)
Returns the String representation of the Cell at location [row][col]


equals

public boolean equals(java.lang.Object o)
Determines the equality of this Board and another one

Overrides:
equals in class java.lang.Object

getCells

public Cell[][] getCells()
Returns this Board's Cells


getDifficulty

public BoardDifficulties getDifficulty()
Returns this Board's difficulty


setDifficulty

public void setDifficulty(BoardDifficulties difficulty)
Sets this Board's difficulty


setID

public void setID(int ID)
Sets this Board's ID


getID

public int getID()
Returns this Board's ID