Package pal.algorithmics
Interface ObjectState
-
- All Known Implementing Classes:
GeneralObjectState
public interface ObjectState
Title: Object State
Description: A stateful, single thread object, that can act upon itself
- Version:
- 1.0
- Author:
- Matthew Goode
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description double
doAction(double currentScore, double desparationValue)
Perform an actionjava.lang.Object
getStateReference()
boolean
isMaximiseScore()
If true, than a bigger score is better, otherwise a smaller score is bettervoid
restoreState(java.lang.Object stateReference)
Used to restore the state of the this object to that of a previous time pointboolean
undoAction()
Undo the last action (if it was successful) Users of an ObjectState should accept that sometimes undoing an action isn't possible.
-
-
-
Method Detail
-
doAction
double doAction(double currentScore, double desparationValue)
Perform an action- Parameters:
currentScore
- The current score before doing the actiondesparationValue
- An indication by the processing machines of willingness to do more extreme actions. A value of 0 means not desparate at all, a value of 1 means very desparate- Returns:
- the current score after doing the action (or the input score if not successful)
-
undoAction
boolean undoAction()
Undo the last action (if it was successful) Users of an ObjectState should accept that sometimes undoing an action isn't possible. If an undo was not possible the object state should be in the same state as it was previous to the call to undoAction()- Returns:
- true if undo was successful
-
getStateReference
java.lang.Object getStateReference()
- Returns:
- An object that can be used to reconstruct the current state of this object
-
restoreState
void restoreState(java.lang.Object stateReference)
Used to restore the state of the this object to that of a previous time point- Parameters:
stateReference
- An object returned by getStateReference()
-
isMaximiseScore
boolean isMaximiseScore()
If true, than a bigger score is better, otherwise a smaller score is better- Returns:
- True if the aim is to maximise
-
-