Class GeneralObjectState

  • All Implemented Interfaces:
    ObjectState

    public class GeneralObjectState
    extends java.lang.Object
    implements ObjectState

    Title:

    Description:

    Copyright: Copyright (c) 2003

    Company:

    Version:
    1.0
    Author:
    not attributable
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • doAction

        public double doAction​(double currentScore,
                               double desparationValue)
        Perform an action
        Specified by:
        doAction in interface ObjectState
        Parameters:
        currentScore - the current score before doing the action
        desparationValue - 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: ObjectState
        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()
        Specified by:
        undoAction in interface ObjectState
        Returns:
        true if undo was successful
      • getStateReference

        public java.lang.Object getStateReference()
        Specified by:
        getStateReference in interface ObjectState
        Returns:
        An object that can be used to reconstruct the current state of this object
      • restoreState

        public void restoreState​(java.lang.Object stateReference)
        Description copied from interface: ObjectState
        Used to restore the state of the this object to that of a previous time point
        Specified by:
        restoreState in interface ObjectState
        Parameters:
        stateReference - An object returned by getStateReference()
      • isMaximiseScore

        public boolean isMaximiseScore()
        Description copied from interface: ObjectState
        If true, than a bigger score is better, otherwise a smaller score is better
        Specified by:
        isMaximiseScore in interface ObjectState
        Returns:
        True if the aim is to maximise