choco.kernel.memory.trailing.trail
Class StoredIntTrail

java.lang.Object
  extended by choco.kernel.memory.trailing.trail.StoredIntTrail
All Implemented Interfaces:
ITrailStorage

public final class StoredIntTrail
extends Object
implements ITrailStorage

Implementing storage of historical values for backtrackable integers.

See Also:
ITrailStorage

Field Summary
 
Fields inherited from interface choco.kernel.memory.trailing.trail.ITrailStorage
LOGGER
 
Constructor Summary
StoredIntTrail(int nUpdates, int nWorlds)
          Constructs a trail with predefined size.
 
Method Summary
 void clear()
           
 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(int wi)
          Comits a world: merging it with the previous one.
 void worldPop(int wi)
          Moving down to the previous world.
 void worldPush(int wi)
          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(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

clear

public void clear()
Specified by:
clear in interface ITrailStorage

worldPush

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

Specified by:
worldPush in interface ITrailStorage
Parameters:
wi -

worldPop

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

Specified by:
worldPop in interface ITrailStorage
Parameters:
wi -

getSize

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

Specified by:
getSize in interface ITrailStorage

worldCommit

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

Specified by:
worldCommit in interface ITrailStorage
Parameters:
wi -

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


Copyright © 2012. All Rights Reserved.