org.drools.examples.sudoku
Class Cell

java.lang.Object
  extended by org.drools.examples.sudoku.SetOfNine
      extended by org.drools.examples.sudoku.Cell

public class Cell
extends SetOfNine

Represents a single cell in the Sudoku grid.


Constructor Summary
Cell()
          Constructor, leaving all references at null.
 
Method Summary
 CellCol getCellCol()
          Returns the column group of nine of this cell.
 CellRow getCellRow()
          Returns the row group of nine of this cell.
 CellSqr getCellSqr()
          Returns the 3x3 block group of nine of this cell.
 int getColNo()
          Returns the column number.
 Set<Cell> getExCells()
          Return the set of Cell objects where contents are mutually exclusive with this cell; they are in the same row or same column or same block.
 int getRowNo()
          Returns the row number.
 Integer getValue()
          Retrieves the value.
 void makeReferences(CellRow row, CellCol col, CellSqr sqr)
          Set references to all cell groups containing this cell.
 String posAsString()
           
 void setValue(Integer value)
          Set the cell value.
 String toString()
           
 String valueAsString()
           
 
Methods inherited from class org.drools.examples.sudoku.SetOfNine
blockExcept, blockValue, getFree, getFreeCount, getFreeValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Cell

public Cell()
Constructor, leaving all references at null. You must call makeReferences to complete the object.

Method Detail

makeReferences

public void makeReferences(CellRow row,
                           CellCol col,
                           CellSqr sqr)
Set references to all cell groups containing this cell.

Parameters:
row - the cell group for the row
col - the cell group for the column
sqr - the cell group for the square 3x3 area

getValue

public Integer getValue()
Retrieves the value.

Returns:
an Integer or null

setValue

public void setValue(Integer value)
Set the cell value.

Parameters:
value - an Integer object

getExCells

public Set<Cell> getExCells()
Return the set of Cell objects where contents are mutually exclusive with this cell; they are in the same row or same column or same block.

Returns:
a Set of Cell objects not including this cell.

getCellRow

public CellRow getCellRow()
Returns the row group of nine of this cell.

Returns:
a CellRow object.

getRowNo

public int getRowNo()
Returns the row number.

Returns:
an int value.

getCellCol

public CellCol getCellCol()
Returns the column group of nine of this cell.

Returns:
a CellCol object.

getColNo

public int getColNo()
Returns the column number.

Returns:
an int value.

getCellSqr

public CellSqr getCellSqr()
Returns the 3x3 block group of nine of this cell.

Returns:
a cellSqr object.

toString

public String toString()
Overrides:
toString in class Object

valueAsString

public String valueAsString()

posAsString

public String posAsString()


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