public class GeneralObjectState extends java.lang.Object implements ObjectState
Title:
Description:
Copyright: Copyright (c) 2003
Company:
Constructor and Description |
---|
GeneralObjectState(UndoableAction action,
StateProvider subject,
boolean maximise) |
Modifier and Type | Method and Description |
---|---|
double |
doAction(double currentScore,
double desparationValue)
Perform an action
|
java.lang.Object |
getStateReference() |
boolean |
isMaximiseScore()
If true, than a bigger score is better, otherwise a smaller score is better
|
void |
restoreState(java.lang.Object stateReference)
Used to restore the state of the this object to that of a previous time point
|
boolean |
undoAction()
Undo the last action (if it was successful)
Users of an ObjectState should accept that sometimes undoing an action isn't possible.
|
public GeneralObjectState(UndoableAction action, StateProvider subject, boolean maximise)
public double doAction(double currentScore, double desparationValue)
doAction
in interface ObjectState
currentScore
- the current score before doing the actiondesparationValue
- An indication of how desparate we are, values closer to 1 mean more desparate while values towards 0 mean less desparatepublic boolean undoAction()
ObjectState
undoAction
in interface ObjectState
public java.lang.Object getStateReference()
getStateReference
in interface ObjectState
public void restoreState(java.lang.Object stateReference)
ObjectState
restoreState
in interface ObjectState
stateReference
- An object returned by getStateReference()public boolean isMaximiseScore()
ObjectState
isMaximiseScore
in interface ObjectState