Package pal.algorithmics
Class GeneralObjectState
java.lang.Object
pal.algorithmics.GeneralObjectState
- All Implemented Interfaces:
ObjectState
Title:
Description:
Copyright: Copyright (c) 2003
Company:
- Version:
- 1.0
- Author:
- not attributable
-
Constructor Summary
ConstructorsConstructorDescriptionGeneralObjectState(UndoableAction action, StateProvider subject, boolean maximise) -
Method Summary
Modifier and TypeMethodDescriptiondoubledoAction(double currentScore, double desparationValue) Perform an actionbooleanIf true, than a bigger score is better, otherwise a smaller score is bettervoidrestoreState(Object stateReference) Used to restore the state of the this object to that of a previous time pointbooleanUndo the last action (if it was successful) Users of an ObjectState should accept that sometimes undoing an action isn't possible.
-
Constructor Details
-
GeneralObjectState
-
-
Method Details
-
doAction
public double doAction(double currentScore, double desparationValue) Perform an action- Specified by:
doActionin interfaceObjectState- Parameters:
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 desparate- Returns:
- the current score after doing the action
-
undoAction
public boolean undoAction()Description copied from interface:ObjectStateUndo 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()- Specified by:
undoActionin interfaceObjectState- Returns:
- true if undo was successful
-
getStateReference
- Specified by:
getStateReferencein interfaceObjectState- Returns:
- An object that can be used to reconstruct the current state of this object
-
restoreState
Description copied from interface:ObjectStateUsed to restore the state of the this object to that of a previous time point- Specified by:
restoreStatein interfaceObjectState- Parameters:
stateReference- An object returned by getStateReference()
-
isMaximiseScore
public boolean isMaximiseScore()Description copied from interface:ObjectStateIf true, than a bigger score is better, otherwise a smaller score is better- Specified by:
isMaximiseScorein interfaceObjectState- Returns:
- True if the aim is to maximise
-