Class EnvironmentTrailing

  • All Implemented Interfaces:
    IEnvironment

    public class EnvironmentTrailing
    extends AbstractEnvironment
    The root class for managing memory and sessions.

    A environment is associated to each problem. It is responsible for managing backtrackable data.

    • Constructor Detail

      • EnvironmentTrailing

        public EnvironmentTrailing()
    • Method Detail

      • worldPush

        public void worldPush()
        Starts a new branch in the search tree.
      • worldPop

        public void worldPop()
        Backtracks to the previous choice point in the search tree.
      • worldCommit

        public void worldCommit()
        Comitting the current world: merging it with the previous one.

        Not used yet.

      • makeInt

        public IStateInt makeInt()
        Factory pattern: new IStateInt objects are created by the environment (no initial value is assigned to the backtrackable search)
        Returns:
        new IStateInt computed by the environment
      • makeInt

        public IStateInt makeInt​(int initialValue)
        Factory pattern: new IStateInt objects are created by the environment
        Parameters:
        initialValue - the initial value of the backtrackable integer
        Returns:
        new IStateInt computed by the environment
      • makeBool

        public IStateBool makeBool​(boolean initialValue)
        Factory pattern: new IStateBool objects are created by the environment
        Parameters:
        initialValue - the initial value of the backtrackable boolean
        Returns:
        Boolean object created by the environment
      • makeIntVector

        public IStateIntVector makeIntVector​(int size,
                                             int initialValue)
        Factory pattern: new IStateIntVector objects are created by the environment
        Parameters:
        size - the number of entries in the vector
        initialValue - the common initial value for all entries (backtrackable integers)
        Returns:
        a backtrackable vector
      • makeDoubleVector

        public IStateDoubleVector makeDoubleVector​(int size,
                                                   double initialValue)
        Factory pattern: new IStateDoubleVector objects are created by the environment
        Parameters:
        size - the number of entries in the vector
        initialValue - the common initial value for all entries (backtrackable integers)
        Returns:
        IStateDoubleVector
      • makeFloat

        public IStateDouble makeFloat()
        Factory pattern: new StoredFloat objects are created by the environment (no initial value is assigned to the backtrackable search)
        Returns:
        new IStateDouble computed by the environment
      • makeFloat

        public IStateDouble makeFloat​(double initialValue)
        Factory pattern: new StoredFloat objects are created by the environment
        Parameters:
        initialValue - the initial value of the backtrackable search
        Returns:
        new IStateDouble computed by the environment
      • makeLong

        public IStateLong makeLong()
        Factory pattern: new backtrackable long attached to this environment.
        Returns:
        a backtrackable long
      • makeLong

        public IStateLong makeLong​(long init)
        Factory pattern: new backtrackable long attached to this environment.
        Parameters:
        init - its initial value
        Returns:
        a backtrackable long
      • setOperationTrail

        public void setOperationTrail​(IOperationTrail otrail)
      • save

        public void save​(IOperation oldValue)
        Description copied from interface: IEnvironment
        Save this operation onto the stack of operations to undo on backtrack.
        Parameters:
        oldValue - operation to undo