Class IntVec

java.lang.Object
org.jacop.jasat.utils.structures.IntVec
All Implemented Interfaces:
Iterable<Integer>

public final class IntVec extends Object implements Iterable<Integer>
low level, efficient int vector
Version:
4.9
  • Field Details

    • array

      public int[] array
    • numElem

      public int numElem
    • pool

      public MemoryPool pool
  • Constructor Details

    • IntVec

      public IntVec(MemoryPool pool)
      initializes the array with a memory pool
      Parameters:
      pool - the pool to use for memory allocation
    • IntVec

      public IntVec(MemoryPool pool, Iterable<Integer> clause)
      initialize from pool and some integers
      Parameters:
      pool - the pool to use
      clause - the elements to add
  • Method Details

    • add

      public void add(int i)
      add an element at the end of the array
      Parameters:
      i - the element to add
    • clear

      public void clear()
      clears all elements in the array
    • isEmpty

      public boolean isEmpty()
      checks if the array contains elements
      Returns:
      true if the array is empty
    • get

      public int get(int index)
    • set

      public void set(int index, int i)
      set the element at index index to i
      Parameters:
      index - the index to modify
      i - the new value
    • size

      public int size()
      number of elements
      Returns:
      number of elements in the vector
    • remove

      public void remove(int index)
      remove the element at index index
      Parameters:
      index - the index of the element to remove
    • removeFast

      public void removeFast(int index)
      this removes the element at given index. This operation does *NOT* keep the order in the array (the last element may change of position)
      Parameters:
      index - the index to remove
    • toArray

      public int[] toArray()
      get a new array from the clause
      Returns:
      a new array
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • iterator

      public Iterator<Integer> iterator()
      Specified by:
      iterator in interface Iterable<Integer>