Package org.drools.examples.sudoku
Class Cell
- java.lang.Object
-
- org.drools.examples.sudoku.SetOfNine
-
- org.drools.examples.sudoku.Cell
-
public class Cell extends SetOfNine
Represents a single cell in the Sudoku grid.
-
-
Constructor Summary
Constructors Constructor Description Cell()Constructor, leaving all references at null.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CellColgetCellCol()Returns the column group of nine of this cell.CellRowgetCellRow()Returns the row group of nine of this cell.CellSqrgetCellSqr()Returns the 3x3 block group of nine of this cell.intgetColNo()Returns the column number.java.util.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.intgetRowNo()Returns the row number.java.lang.IntegergetValue()Retrieves the value.voidmakeReferences(CellRow row, CellCol col, CellSqr sqr)Set references to all cell groups containing this cell.java.lang.StringposAsString()voidsetValue(java.lang.Integer value)Set the cell value.java.lang.StringtoString()java.lang.StringvalueAsString()-
Methods inherited from class org.drools.examples.sudoku.SetOfNine
blockExcept, blockValue, getFree, getFreeCount, getFreeValue
-
-
-
-
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 rowcol- the cell group for the columnsqr- the cell group for the square 3x3 area
-
getValue
public java.lang.Integer getValue()
Retrieves the value.- Returns:
- an Integer or null
-
setValue
public void setValue(java.lang.Integer value)
Set the cell value.- Parameters:
value- an Integer object
-
getExCells
public java.util.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 java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
valueAsString
public java.lang.String valueAsString()
-
posAsString
public java.lang.String posAsString()
-
-