choco.kernel.memory.trailing
Class StoredInt

java.lang.Object
  extended by choco.kernel.memory.trailing.AbstractStoredObject
      extended by choco.kernel.memory.trailing.StoredInt
All Implemented Interfaces:
IStateInt
Direct Known Subclasses:
StoredIntProcedure

public class StoredInt
extends AbstractStoredObject
implements IStateInt

A class implementing backtrackable integers.


Field Summary
protected  StoredIntTrail myTrail
           
 
Fields inherited from class choco.kernel.memory.trailing.AbstractStoredObject
environment, LOGGER, worldStamp
 
Fields inherited from interface choco.kernel.memory.IStateInt
MAXINT, MININT, UNKNOWN_INT
 
Constructor Summary
StoredInt(EnvironmentTrailing env, int i)
          Constructs a stored search with an initial value.
 
Method Summary
 void _set(int y, int wstamp)
          Modifies the value without storing the former value on the trailing stack.
 int add(int delta)
          Modifying a StoredInt by an increment.
 int decrement()
          Modifying a StoredInt by subtracting an unit increment.
 int get()
          Returns the current value according to the current world.
 int increment()
          Modifying a StoredInt by adding an unit increment.
 void set(int y)
          Modifies the value and stores if needed the former value on the trailing stack.
 String toString()
           
 
Methods inherited from class choco.kernel.memory.trailing.AbstractStoredObject
getEnvironment, getWorldStamp, setWorldStamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface choco.kernel.memory.IStateInt
getEnvironment
 

Field Detail

myTrail

protected final StoredIntTrail myTrail
Constructor Detail

StoredInt

public StoredInt(EnvironmentTrailing env,
                 int i)
Constructs a stored search with an initial value. Note: this constructor should not be used directly: one should instead use the IEnvironment factory

Method Detail

add

public final int add(int delta)
Description copied from interface: IStateInt
Modifying a StoredInt by an increment.

Specified by:
add in interface IStateInt
Parameters:
delta - the value to add to the current value.
Returns:
the updated value

increment

public int increment()
Description copied from interface: IStateInt
Modifying a StoredInt by adding an unit increment.

Specified by:
increment in interface IStateInt
Returns:
the updated value

decrement

public int decrement()
Description copied from interface: IStateInt
Modifying a StoredInt by subtracting an unit increment.

Specified by:
decrement in interface IStateInt
Returns:
the updated value

get

public final int get()
Description copied from interface: IStateInt
Returns the current value according to the current world.

Specified by:
get in interface IStateInt
Returns:
The current value of the storable variable.

set

public final void set(int y)
Modifies the value and stores if needed the former value on the trailing stack.

Specified by:
set in interface IStateInt
Parameters:
y - the new value of the variable.

_set

public void _set(int y,
                 int wstamp)
Modifies the value without storing the former value on the trailing stack.

Parameters:
y - the new value
wstamp - the stamp of the world in which the update is performed

toString

public final String toString()
Overrides:
toString in class Object


Copyright © 2012. All Rights Reserved.