Class IntList

java.lang.Object
org.jparsec.internal.util.IntList

public final class IntList extends Object
A simple, efficient and dynamic int list.

Not thread-safe.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private int[]
     
    private int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an empty IntList object.
    IntList(int capacity)
    Creates an IntList object with initial capacity equal to capacity.
  • Method Summary

    Modifier and Type
    Method
    Description
    add(int i)
    Adds i into the array.
    (package private) static int
    calcSize(int expectedSize, int factor)
     
    private void
    checkIndex(int i)
     
    void
    ensureCapacity(int capacity)
    Ensures that there is at least l capacity.
    int
    get(int i)
    Gets the int value at a index i.
    private void
    grow(int l)
     
    int
    set(int i, int val)
    Sets the value at index i to val.
    int
    Gets the number of int values stored.
    int[]
    Creates a int[] object with all the elements.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • buf

      private int[] buf
    • len

      private int len
  • Constructor Details

    • IntList

      public IntList(int capacity)
      Creates an IntList object with initial capacity equal to capacity.
    • IntList

      public IntList()
      Creates an empty IntList object.
  • Method Details

    • toArray

      public int[] toArray()
      Creates a int[] object with all the elements.
    • size

      public int size()
      Gets the number of int values stored.
    • checkIndex

      private void checkIndex(int i)
    • get

      public int get(int i)
      Gets the int value at a index i.
      Parameters:
      i - the 0 - based index of the value.
      Returns:
      the int value.
      Throws:
      ArrayIndexOutOfBoundsException - if i < 0 or i >= size().
    • set

      public int set(int i, int val)
      Sets the value at index i to val.
      Parameters:
      i - the 0 - based index.
      val - the new value.
      Returns:
      the old value.
      Throws:
      ArrayIndexOutOfBoundsException - if i < 0 or i >= size().
    • calcSize

      static int calcSize(int expectedSize, int factor)
    • ensureCapacity

      public void ensureCapacity(int capacity)
      Ensures that there is at least l capacity.
      Parameters:
      capacity - the minimal capacity.
    • grow

      private void grow(int l)
    • add

      public IntList add(int i)
      Adds i into the array.
      Parameters:
      i - the int value.
      Returns:
      this object.