- java.lang.Object
-
- org.chocosolver.memory.IStateDoubleVector
-
- org.chocosolver.memory.trailing.StoredDoubleVector
-
public final class StoredDoubleVector extends IStateDoubleVector
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 StoredDoubleVectorTrail
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.IStateDoubleVector
elementData, environment, MIN_CAPACITY, size
-
-
Constructor Summary
Constructors Constructor Description StoredDoubleVector(EnvironmentTrailing env, int initialSize, double 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 double
_set(int index, double val, int stamp)
Sets an element without storing the previous value.void
add(double 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.double
quickSet(int index, double val)
Unsafe setter => don't do bound verificationvoid
remove(int i)
Removes an int.void
removeLast()
removes the search at the end of the vector.double
set(int index, double val)
Assigns a new valueval
to the elementindex
.-
Methods inherited from class org.chocosolver.memory.IStateDoubleVector
get, 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 StoredDoubleVectorTrail myTrail
-
-
Constructor Detail
-
StoredDoubleVector
public StoredDoubleVector(EnvironmentTrailing env, int initialSize, double 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(double i)
Adds a new search at the end of the vector.- 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 double set(int index, double val)
Assigns a new valueval
to the elementindex
.
-
quickSet
public double quickSet(int index, double val)
Description copied from class:IStateDoubleVector
Unsafe setter => don't do bound verification- Specified by:
quickSet
in classIStateDoubleVector
- Parameters:
index
- the index of the replaced valueval
- the new value- Returns:
- the old value
-
_set
public double _set(int index, double val, int stamp)
Sets an element without storing the previous value.- Parameters:
index
- Index where to setval
- value to be changedstamp
- world when the modification is done- Returns:
- the old value
-
-