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

      • worldStamps

        public int[] worldStamps
        Contains time stamps for all entries (the world index of the last update for each entry)
    • Constructor Detail

      • StoredIntVector

        public StoredIntVector​(EnvironmentTrailing env,
                               int initialSize,
                               int initialValue)
        Constructs a stored search vector with an initial size, and initial values.
        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.
        minCapacity - the necessary capacity.
      • add

        public void add​(int i)
        Adds a new search at the end of the vector.
        Specified by:
        add in class IStateIntVector
        i - The search to add.
      • remove

        public void remove​(int i)
        Removes an int.
        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 value val to the element index.
        Specified by:
        set in class IStateIntVector
      • 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 class IStateIntVector
        index - the index where the value is modified
        val - the new value
        the old value
      • _set

        public int _set​(int index,
                        int val,
                        int stamp)
        Sets an element without storing the previous value.