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 ObjectStatecurrentScore - 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()
ObjectStateundoAction in interface ObjectStatepublic java.lang.Object getStateReference()
getStateReference in interface ObjectStatepublic void restoreState(java.lang.Object stateReference)
ObjectStaterestoreState in interface ObjectStatestateReference - An object returned by getStateReference()public boolean isMaximiseScore()
ObjectStateisMaximiseScore in interface ObjectState