tasks
Class SudokuTask
java.lang.Object
api.Task
tasks.SudokuTask
- All Implemented Interfaces:
- TaskInterface, java.io.Serializable
public class SudokuTask
- extends Task
- See Also:
- Serialized Form
Constructor Summary |
SudokuTask(Board board,
int row,
int col,
int value)
Constructor called when a child task is spawned recursively in the run method. |
SudokuTask(int row,
int col,
int[][] userValues)
Constructor to be called by the client. |
Method Summary |
Result |
run(Shared shared)
Finds the next cell in the grid that has not yet been set and spawns children tasks
with the possible values set. |
void |
setInput(Result r)
Empty function. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SudokuTask
public SudokuTask(int row,
int col,
int[][] userValues)
- Constructor to be called by the client. Constructs the original Suduko task to be solved.
- Parameters:
row
- The number of rows in the grid.col
- The number of columns in the grid.userValues
- The initial values set for a partially completed grid.
SudokuTask
public SudokuTask(Board board,
int row,
int col,
int value)
- Constructor called when a child task is spawned recursively in the run method.
- Parameters:
board
- The partially solved board.row
- The row the cell to be set is in.col
- The column the cell to be set is in.value
- The value to set in the cell.
run
public Result run(Shared shared)
- Finds the next cell in the grid that has not yet been set and spawns children tasks
with the possible values set. Stops current task computation if the set value is found invalid.
- Specified by:
run
in interface TaskInterface
- Specified by:
run
in class Task
- Returns:
- The solution when it is found. null when there was no solution found.
setInput
public void setInput(Result r)
- Description copied from class:
Task
- Empty function. SHOULD be overwritten by any classes that
extend this class.
- Specified by:
setInput
in interface TaskInterface
- Specified by:
setInput
in class Task
- Parameters:
r
- The Result that is a partial solution.