choco.mem
Class StoredIntTrail

java.lang.Object
  extended by choco.mem.StoredIntTrail
All Implemented Interfaces:
ITrailStorage

public final class StoredIntTrail
extends java.lang.Object
implements ITrailStorage

Implementing storage of historical values for backtrackable integers.

See Also:
ITrailStorage

Constructor Summary
StoredIntTrail(Environment env, int nUpdates, int nWorlds)
          Constructs a trail with predefined size.
 
Method Summary
 int getSize()
          Returns the current size of the stack.
 void resizeWorldCapacity(int newWorldCapacity)
          increase the capacity of the environment to a given number of worlds
 void savePreviousState(StoredInt v, int oldValue, int oldStamp)
          Reacts when a StoredInt is modified: push the former value & timestamp on the stacks.
 void worldCommit()
          Comits a world: merging it with the previous one.
 void worldPop()
          Moving down to the previous world.
 void worldPush()
          Moving up to the next world.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StoredIntTrail

public StoredIntTrail(Environment env,
                      int nUpdates,
                      int nWorlds)
Constructs a trail with predefined size.

Parameters:
nUpdates - maximal number of updates that will be stored
nWorlds - maximal number of worlds that will be stored
Method Detail

worldPush

public void worldPush()
Moving up to the next world.

Specified by:
worldPush in interface ITrailStorage

worldPop

public void worldPop()
Moving down to the previous world.

Specified by:
worldPop in interface ITrailStorage

getSize

public int getSize()
Returns the current size of the stack.

Specified by:
getSize in interface ITrailStorage

worldCommit

public void worldCommit()
Comits a world: merging it with the previous one.

Specified by:
worldCommit in interface ITrailStorage

savePreviousState

public void savePreviousState(StoredInt v,
                              int oldValue,
                              int oldStamp)
Reacts when a StoredInt is modified: push the former value & timestamp on the stacks.


resizeWorldCapacity

public void resizeWorldCapacity(int newWorldCapacity)
Description copied from interface: ITrailStorage
increase the capacity of the environment to a given number of worlds

Specified by:
resizeWorldCapacity in interface ITrailStorage