Package org.jparsec.internal.util
Class IntList
java.lang.Object
org.jparsec.internal.util.IntList
A simple, efficient and dynamic int list.
Not thread-safe.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd
(int i) Addsi
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 leastl
capacity.int
get
(int i) Gets the int value at a indexi
.private void
grow
(int l) int
set
(int i, int val) Sets the value at indexi
toval
.int
size()
Gets the number of int values stored.int[]
toArray()
Creates aint[]
object with all the elements.
-
Field Details
-
buf
private int[] buf -
len
private int len
-
-
Constructor Details
-
Method Details
-
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:
ArrayIndexOutOfBoundsException
- ifi < 0 or i >= size()
.
-
set
public int set(int i, int val) Sets the value at indexi
toval
.- Parameters:
i
- the 0 - based index.val
- the new value.- Returns:
- the old value.
- Throws:
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 leastl
capacity.- Parameters:
capacity
- the minimal capacity.
-
grow
private void grow(int l) -
add
Addsi
into the array.- Parameters:
i
- the int value.- Returns:
- this object.
-