com.act365.sudoku
Class LinearSystemState

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

public class LinearSystemState
extends java.lang.Object
implements IState

LinearSystemState stores the system of linear equations defined by the Sudoku puzzle.


Field Summary
static int defaultDisplayFormat
           
static int EQUATIONS
           
static int MATRIX
           
 
Constructor Summary
LinearSystemState()
           
 
Method Summary
 void addMove(int x, int y, int v)
          Adds the constraint (x,y):=v to the system and reduces.
 void eliminateMove(int x, int y, int v)
          Updates the state grid to account for the fact that the move (x,y):=v has been eliminated as a possibility.
 void popState(int nMoves)
          Unwinds a state grid from the thread.
 void pushState(int nMoves)
          Adds a state grid to the thread.
 void setup(int boxesAcross, int boxesDown)
          Sets up the state grid and its thread.
 java.lang.String toString()
          String representation
 java.lang.String toString(int v, int displayFormat)
          String representation of the equations for the chosen value in the chosen display format.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EQUATIONS

public static final int EQUATIONS
See Also:
Constant Field Values

MATRIX

public static final int MATRIX
See Also:
Constant Field Values

defaultDisplayFormat

public static int defaultDisplayFormat
Constructor Detail

LinearSystemState

public LinearSystemState()
Method Detail

setup

public void setup(int boxesAcross,
                  int boxesDown)
Description copied from interface: IState
Sets up the state grid and its thread.

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

pushState

public void pushState(int nMoves)
Description copied from interface: IState
Adds a state grid to the thread.

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)
Description copied from interface: IState
Unwinds a state grid from the thread.

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 v)
             throws MoveException
Adds the constraint (x,y):=v to the system and reduces.

Specified by:
addMove in interface IState
Throws:
MoveException
See Also:
IState.addMove(int, int, int)

eliminateMove

public void eliminateMove(int x,
                          int y,
                          int v)
Description copied from interface: IState
Updates the state grid to account for the fact that the move (x,y):=v has been eliminated as a possibility.

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

toString

public java.lang.String toString()
String representation

Specified by:
toString in interface IState

toString

public java.lang.String toString(int v,
                                 int displayFormat)
String representation of the equations for the chosen value in the chosen display format.