Package org.chocosolver.memory.trailing
Class StoredIntVector
- java.lang.Object
-
- org.chocosolver.memory.IStateIntVector
-
- org.chocosolver.memory.trailing.StoredIntVector
-
public final class StoredIntVector extends IStateIntVector
Implements a backtrackable search vector. Cette classe permet de stocker facilment des entiers dans un tableau backtrackable d'entiers.
-
-
Field Summary
Fields Modifier and Type Field Description protected StoredIntVectorTrailmyTrailint[]worldStampsContains time stamps for all entries (the world index of the last update for each entry)-
Fields inherited from class org.chocosolver.memory.IStateIntVector
elementData, environment, MIN_CAPACITY, size
-
-
Constructor Summary
Constructors Constructor Description StoredIntVector(EnvironmentTrailing env, int initialSize, int initialValue)Constructs a stored search vector with an initial size, and initial values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int_set(int index, int val, int stamp)Sets an element without storing the previous value.voidadd(int i)Adds a new search at the end of the vector.voidensureCapacity(int minCapacity)Checks if the capacity is great enough, else the capacity is extended.intquickSet(int index, int val)Assigns a new value val to the element indexth and return the old value without bound checkvoidremove(int i)Removes an int.voidremoveLast()removes the search at the end of the vector.intset(int index, int val)Assigns a new valuevalto the elementindex.-
Methods inherited from class org.chocosolver.memory.IStateIntVector
quickGet, rangeCheck
-
-
-
-
Field Detail
-
worldStamps
public int[] worldStamps
Contains time stamps for all entries (the world index of the last update for each entry)
-
myTrail
protected final StoredIntVectorTrail myTrail
-
-
Constructor Detail
-
StoredIntVector
public StoredIntVector(EnvironmentTrailing env, int initialSize, int initialValue)
Constructs a stored search vector with an initial size, and initial values.- Parameters:
env- The current environment.initialSize- The initial size.initialValue- The initial common value.
-
-
Method Detail
-
ensureCapacity
public void ensureCapacity(int minCapacity)
Checks if the capacity is great enough, else the capacity is extended.- Parameters:
minCapacity- the necessary capacity.
-
add
public void add(int i)
Adds a new search at the end of the vector.- Specified by:
addin classIStateIntVector- Parameters:
i- The search to add.
-
remove
public void remove(int i)
Removes an int.- Parameters:
i- The search to remove.
-
removeLast
public void removeLast()
removes the search at the end of the vector. does nothing when called on an empty vector
-
set
public int set(int index, int val)Assigns a new valuevalto the elementindex.- Specified by:
setin classIStateIntVector
-
quickSet
public final int quickSet(int index, int val)Description copied from class:IStateIntVectorAssigns a new value val to the element indexth and return the old value without bound check- Specified by:
quickSetin classIStateIntVector- Parameters:
index- the index where the value is modifiedval- the new value- Returns:
- the old value
-
_set
public int _set(int index, int val, int stamp)Sets an element without storing the previous value.
-
-