Class 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 Detail

      • worldStamps

        public int[] worldStamps
        Contains time stamps for all entries (the world index of the last update for each entry)
    • 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 value val to the element index.
      • quickSet

        public double quickSet​(int index,
                               double val)
        Description copied from class: IStateDoubleVector
        Unsafe setter => don't do bound verification
        Specified by:
        quickSet in class IStateDoubleVector
        Parameters:
        index - the index of the replaced value
        val - 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 set
        val - value to be changed
        stamp - world when the modification is done
        Returns:
        the old value