org.drools.examples.sudoku
Class Sudoku

java.lang.Object
  extended by org.drools.examples.sudoku.swing.AbstractSudokuGridModel
      extended by org.drools.examples.sudoku.Sudoku
All Implemented Interfaces:
SudokuGridModel

public class Sudoku
extends AbstractSudokuGridModel
implements SudokuGridModel

An object of this class solves Sudoku problems.


Field Summary
 Cell[][] cells
           
static Sudoku sudoku
           
 
Fields inherited from interface org.drools.examples.sudoku.swing.SudokuGridModel
INNER_GRID_HEIGHT, INNER_GRID_WIDTH, NUM_COLS, NUM_ROWS
 
Constructor Summary
Sudoku(org.drools.KnowledgeBase kBase)
          Constructor.
 
Method Summary
 void consistencyCheck()
          Checks that everything is still according to the sudoku rules.
 void dumpGrid()
          Nice printout of the grid.
 String getCellValue(int iRow, int iCol)
           
 boolean isSolved()
           
 boolean isUnsolvable()
           
 void setCellValues(Integer[][] cellValues)
           
 void solve()
           
 void step()
           
 String toString()
           
 void validate()
           
 
Methods inherited from class org.drools.examples.sudoku.swing.AbstractSudokuGridModel
addSudokuGridListener, fireCellUpdatedEvent, fireRestartEvent, removeSudokuGridListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.drools.examples.sudoku.swing.SudokuGridModel
addSudokuGridListener, removeSudokuGridListener
 

Field Detail

sudoku

public static Sudoku sudoku

cells

public Cell[][] cells
Constructor Detail

Sudoku

public Sudoku(org.drools.KnowledgeBase kBase)
Constructor.

Parameters:
kBase - a Knowledge Base with rules for solving Sudoku problems.
Method Detail

getCellValue

public String getCellValue(int iRow,
                           int iCol)
Specified by:
getCellValue in interface SudokuGridModel

dumpGrid

public void dumpGrid()
Nice printout of the grid.


consistencyCheck

public void consistencyCheck()
Checks that everything is still according to the sudoku rules.


solve

public void solve()
Specified by:
solve in interface SudokuGridModel

step

public void step()
Specified by:
step in interface SudokuGridModel

isSolved

public boolean isSolved()

isUnsolvable

public boolean isUnsolvable()

setCellValues

public void setCellValues(Integer[][] cellValues)
Specified by:
setCellValues in interface SudokuGridModel

toString

public String toString()
Overrides:
toString in class Object

validate

public void validate()


Copyright © 2001-2013 JBoss Inc.. All Rights Reserved.