choco.mem
Class StoredInt

java.lang.Object
  extended by choco.mem.StoredInt
All Implemented Interfaces:
IStateInt

public final class StoredInt
extends java.lang.Object
implements IStateInt

A class implementing backtrackable integers.


Field Summary
 
Fields inherited from interface choco.mem.IStateInt
MAXINT, MININT, UNKNOWN_INT
 
Constructor Summary
StoredInt(Environment env)
          Constructs a stored search with an unknown initial value.
StoredInt(Environment env, int i)
          Constructs a stored search with an initial value.
 
Method Summary
 void add(int delta)
          modifying a StoredInt by an increment
 int get()
          Returns the current value.
 Environment getEnvironment()
          Retrieving the environment
 boolean isKnown()
          Checks if a value is currently stored.
 void set(int y)
          Modifies the value and stores if needed the former value on the trailing stack.
 java.lang.String toString()
          pretty printing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StoredInt

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


StoredInt

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

Method Detail

get

public int get()
Returns the current value.

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

isKnown

public boolean isKnown()
Checks if a value is currently stored.

Specified by:
isKnown in interface IStateInt
Returns:
true if the value is known (different from UNKNOWN_INT).

set

public 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.

add

public void add(int delta)
modifying a StoredInt by an increment

Specified by:
add in interface IStateInt
Parameters:
delta -

getEnvironment

public Environment getEnvironment()
Retrieving the environment

Specified by:
getEnvironment in interface IStateInt
Returns:
the environment associated to this variable (the object responsible to manage worlds and storable variables).

toString

public java.lang.String toString()
pretty printing

Overrides:
toString in class java.lang.Object