com.carlosbcruz.model
Class Board

java.lang.Object
  extended by com.carlosbcruz.model.Board
All Implemented Interfaces:
java.lang.Cloneable

public class Board
extends java.lang.Object
implements java.lang.Cloneable

Represent a board

Author:
Carlos Fernando Bella Cruz - pessoal@carlosbcruz.com

Constructor Summary
Board()
           
 
Method Summary
 Board createClone()
          Generate a copy of the current board.
 int getValue(int x, int y)
          Consult a value on a position of the board.
 boolean isSolved()
          See if the board problem is solved.
 void setValue(int x, int y, int newValue)
          Set a value in the board.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Board

public Board()
Method Detail

setValue

public void setValue(int x,
                     int y,
                     int newValue)
Set a value in the board.

Parameters:
x - row
y - column
newValue - new value to be inserted in the board at x row by y column

getValue

public int getValue(int x,
                    int y)
Consult a value on a position of the board.

Parameters:
x - row
y - colunn
Returns:
stored value

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

isSolved

public boolean isSolved()
See if the board problem is solved.

Returns:
true or false

createClone

public Board createClone()
Generate a copy of the current board.

Returns:
a new board copy