- 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 StoredIntVectorTrail
myTrail
int[]
worldStamps
Contains 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.void
add(int i)
Adds a new search at the end of the vector.void
ensureCapacity(int minCapacity)
Checks if the capacity is great enough, else the capacity is extended.int
quickSet(int index, int val)
Assigns a new value val to the element indexth and return the old value without bound checkvoid
remove(int i)
Removes an int.void
removeLast()
removes the search at the end of the vector.int
set(int index, int val)
Assigns a new valueval
to 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:
add
in 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 valueval
to the elementindex
.- Specified by:
set
in classIStateIntVector
-
quickSet
public final int quickSet(int index, int val)
Description copied from class:IStateIntVector
Assigns a new value val to the element indexth and return the old value without bound check- Specified by:
quickSet
in 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.
-
-