choco.kernel.memory.trailing.trail
Class StoredDoubleTrail

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

public class StoredDoubleTrail
extends Object
implements ITrailStorage

A backtrackable float variable trail storing past values of all the float variables.


Field Summary
 
Fields inherited from interface choco.kernel.memory.trailing.trail.ITrailStorage
LOGGER
 
Constructor Summary
StoredDoubleTrail(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)
          Resizes the data structure to manage more values.
 void savePreviousState(StoredDouble v, double oldValue, int oldStamp)
          Reacts when a StoredInt is modified: push the former value & timestamp on the stacks.
 void worldCommit(int wi)
          Commits 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

StoredDoubleTrail

public StoredDoubleTrail(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
Returns:
the size of the trail

worldCommit

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

Specified by:
worldCommit in interface ITrailStorage
Parameters:
wi -

savePreviousState

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

Parameters:
v - tha variable to store the value
oldValue - the previous value to store
oldStamp - the previous stamp value (to know when this old value will be updated again when backtracking)

resizeWorldCapacity

public void resizeWorldCapacity(int newWorldCapacity)
Resizes the data structure to manage more values.

Specified by:
resizeWorldCapacity in interface ITrailStorage
Parameters:
newWorldCapacity - the new capacity requested for world management


Copyright © 2012. All Rights Reserved.