T - a subclass of PuzzleInstancepublic abstract class AbstractAlgorithm<T extends PuzzleInstance> extends java.lang.Object implements AlgorithmInterface<T>
| Constructor and Description |
|---|
AbstractAlgorithm() |
| Modifier and Type | Method and Description |
|---|---|
long |
getNumberOfOperations()
Assuming the subclasses keep track, get the number of operations performed so far, where "operation" is defined
however the algorithm would like.
|
AlgorithmStates |
getState()
Get the current state of the algorithm.
|
abstract void |
initializeData()
setProblemData is already implemented for you, but you might need to initialize other data related to your
algorithm.
|
boolean |
isDone()
Check if the current state is DONE.
|
boolean |
isNotDone()
Check if the current state is NOT_DONE
|
boolean |
isQuit()
Check if the current state is QUIT.
|
void |
setProblemData(T puzzle) |
void |
setState(AlgorithmStates state)
Sets the state of the algorithm to state.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitargumentFormat, countsOperations, getCurrentProblemData, getProblemType, getProgressReport, getResult, getVersion, parseArguments, quit, runAlgorithmpublic abstract void initializeData()
public void setProblemData(T puzzle)
setProblemData in interface AlgorithmInterface<T extends PuzzleInstance>puzzle - the puzzle to run the algorithm on. The algorithm may or may not use this directly, so there should
be no expectation that either the puzzle you pass in will be updated/changed by the algorithm or that
it won't.public AlgorithmStates getState()
AlgorithmInterfacegetState in interface AlgorithmInterface<T extends PuzzleInstance>public void setState(AlgorithmStates state)
AlgorithmInterfacesetState in interface AlgorithmInterface<T extends PuzzleInstance>state - What state the algorithm should be set to.public long getNumberOfOperations()
AlgorithmInterfacegetNumberOfOperations in interface AlgorithmInterface<T extends PuzzleInstance>public boolean isDone()
AlgorithmStatespublic boolean isQuit()
AlgorithmStatespublic boolean isNotDone()
AlgorithmStates