Package org.jparsec.internal.util
Class IntList
- java.lang.Object
-
- org.jparsec.internal.util.IntList
-
public final class IntList extends java.lang.ObjectA simple, efficient and dynamic int list.Not thread-safe.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IntListadd(int i)Addsiinto the array.(package private) static intcalcSize(int expectedSize, int factor)private voidcheckIndex(int i)voidensureCapacity(int capacity)Ensures that there is at leastlcapacity.intget(int i)Gets the int value at a indexi.private voidgrow(int l)intset(int i, int val)Sets the value at indexitoval.intsize()Gets the number of int values stored.int[]toArray()Creates aint[]object with all the elements.
-
-
-
Method Detail
-
toArray
public int[] toArray()
Creates aint[]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 indexi.- Parameters:
i- the 0 - based index of the value.- Returns:
- the int value.
- Throws:
java.lang.ArrayIndexOutOfBoundsException- ifi < 0 or i >= size().
-
set
public int set(int i, int val)Sets the value at indexitoval.- Parameters:
i- the 0 - based index.val- the new value.- Returns:
- the old value.
- Throws:
java.lang.ArrayIndexOutOfBoundsException- ifi < 0 or i >= size().
-
calcSize
static int calcSize(int expectedSize, int factor)
-
ensureCapacity
public void ensureCapacity(int capacity)
Ensures that there is at leastlcapacity.- Parameters:
capacity- the minimal capacity.
-
grow
private void grow(int l)
-
add
public IntList add(int i)
Addsiinto the array.- Parameters:
i- the int value.- Returns:
- this object.
-
-