com.act365.sudoku
Class NumberState

java.lang.Object
  extended bycom.act365.sudoku.NumberState
All Implemented Interfaces:
IState

public class NumberState
extends java.lang.Object
implements IState

NumberState records the number of candidates remain for each value/sector on the grid, where a sector is any row, column or subgrid.


Constructor Summary
NumberState()
           
 
Method Summary
 void addMove(int x, int y, int value)
          Adds the move (x,y):=v to the state grid.
 void eliminateMove(int x, int y, int value)
          Eliminates the move (x,y):=v from the current state grid.
 void popState(int nMoves)
          Reads the state gris from the stack at the appropriate position.
 void pushState(int nMoves)
          Writes the state grid to the stack at the appropriate position.
 void setup(int boxesAcross, int boxesDown)
          Sets the state grid to the appropriate size.
 java.lang.String toString()
          Produces a string representation of the state grid.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NumberState

public NumberState()
Method Detail

setup

public void setup(int boxesAcross,
                  int boxesDown)
Sets the state grid to the appropriate size.

Specified by:
setup in interface IState
See Also:
IState.setup(int,int)

pushState

public void pushState(int nMoves)
Writes the state grid to the stack at the appropriate position.

Specified by:
pushState in interface IState
Parameters:
nMoves - thread position to which state should be written
See Also:
IState.pushState(int)

popState

public void popState(int nMoves)
Reads the state gris from the stack at the appropriate position.

Specified by:
popState in interface IState
Parameters:
nMoves - thread position from which state should be read
See Also:
IState.popState(int)

addMove

public void addMove(int x,
                    int y,
                    int value)
             throws java.lang.Exception
Adds the move (x,y):=v to the state grid.

Specified by:
addMove in interface IState
Parameters:
value - is in the range [0,cellsInRow), not [1,cellsInRow].
Throws:
java.lang.Exception
See Also:
IState.addMove(int, int, int)

eliminateMove

public void eliminateMove(int x,
                          int y,
                          int value)
Eliminates the move (x,y):=v from the current state grid.

Specified by:
eliminateMove in interface IState
Parameters:
value - is in the range [0,cellsInRow), not [1,cellsInRow].
See Also:
IState.eliminateMove(int, int, int)

toString

public java.lang.String toString()
Produces a string representation of the state grid.

Specified by:
toString in interface IState