|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.co.keang.sudoku.solver.AbstractSolver
public abstract class AbstractSolver
An abstract sudouku solver pattern
Nested Class Summary | |
---|---|
static class |
AbstractSolver.SolverDifficulty
|
Field Summary | |
---|---|
protected int |
found
|
protected Puzzle.Cell[][] |
hGrid
|
protected Puzzle |
puzzle
|
Constructor Summary | |
---|---|
AbstractSolver(Puzzle p,
int factor,
AbstractSolver.SolverDifficulty dif)
Constructs a solver |
Method Summary | |
---|---|
void |
addSolverListener(SolverListener l)
Adds a solver listener. |
abstract int |
findSolutions()
Runs the solver once to try to resolve individual squares |
protected void |
fireSolutionEvent(SolutionEvent event)
fires the possibilities reduced event to all listeners |
int |
getDifficultyFactor()
Gets a difficulty factor for this solver where the higher the number the higher the level of expertise required to solve the puzzle |
AbstractSolver.SolverDifficulty |
getSolverDifficulty()
Gets the minimum difficulty of this solver |
protected boolean |
hasSolverListeners()
True if there are registered solver listeners |
protected Puzzle.Cell |
removeAllFromSet(Puzzle.Cell possibleVals,
Puzzle.Cell removeVals)
Removes the values from the possible values |
void |
removeAllSolverListeners()
Removes all the solver listeners |
void |
removeSolverListener(SolverListener l)
Removes the solver listener |
protected Puzzle.Cell |
retainAllInSet(Puzzle.Cell possibleVals,
Puzzle.Cell retainVals)
Retains these values removing all other possible values |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int found
protected final Puzzle puzzle
protected final Puzzle.Cell[][] hGrid
Constructor Detail |
---|
AbstractSolver(Puzzle p, int factor, AbstractSolver.SolverDifficulty dif)
hGrid
- Method Detail |
---|
public abstract int findSolutions() throws IllegalGridException
IllegalGridException
public AbstractSolver.SolverDifficulty getSolverDifficulty()
public void addSolverListener(SolverListener l)
l
- - the listener to addpublic void removeSolverListener(SolverListener l)
l
- - the listener to removepublic void removeAllSolverListeners()
l
- - the listener to removeprotected boolean hasSolverListeners()
protected void fireSolutionEvent(SolutionEvent event)
protected final Puzzle.Cell removeAllFromSet(Puzzle.Cell possibleVals, Puzzle.Cell removeVals)
possibleVals
- the set of possible valuesremoveVals
- the values to remove
protected final Puzzle.Cell retainAllInSet(Puzzle.Cell possibleVals, Puzzle.Cell retainVals)
possibleVals
- the set of possible valuesremoveVals
- the values to remove
public int getDifficultyFactor()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |