Top Description Fields Constructors Methods
org.jparsec.internal.util

public final Class IntList

extends Object
Class Inheritance
Imports
org.jparsec.internal.annotations.Private

A simple, efficient and dynamic int list.

Not thread-safe.

Author
Ben Yu.

Field Summary

Modifier and TypeField and Description
private int[]
private int

Constructor Summary

AccessConstructor and Description
public
IntList(int capacity)

Creates an IntList object with initial capacity equal to capacity.

public
IntList()

Creates an empty IntList object.

Method Summary

Modifier and TypeMethod and Description
public IntList

Returns:

this object.
add
(int
the int value.
i
)

Adds i into the array.

pack-priv static int
calcSize(int expectedSize, int factor)

private void
checkIndex(int i)

public void
ensureCapacity(int
the minimal capacity.
capacity
)

Ensures that there is at least l capacity.

public int

Returns:

the int value.
get
(int
the 0 - based index of the value.
i
)

Gets the int value at a index i.

private void
grow(int l)

public int

Returns:

the old value.
set
(int
the 0 - based index.
i
,
int
the new value.
val
)

Sets the value at index i to val.

public int
size()

Gets the number of int values stored.

public int[]
toArray()

Creates a int[] object with all the elements.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufback to summary
private int[] buf
lenback to summary
private int len

Constructor Detail

IntListback to summary
public IntList(int capacity)

Creates an IntList object with initial capacity equal to capacity.

IntListback to summary
public IntList()

Creates an empty IntList object.

Method Detail

addback to summary
public IntList add(int i)

Adds i into the array.

Parameters
i:int

the int value.

Returns:IntList

this object.

calcSizeback to summary
pack-priv static int calcSize(int expectedSize, int factor)
Annotations
@Private
checkIndexback to summary
private void checkIndex(int i)
ensureCapacityback to summary
public void ensureCapacity(int capacity)

Ensures that there is at least l capacity.

Parameters
capacity:int

the minimal capacity.

getback to summary
public int get(int i)

Gets the int value at a index i.

Parameters
i:int

the 0 - based index of the value.

Returns:int

the int value.

Exceptions
ArrayIndexOutOfBoundsException:
if i < 0 or i >= size().
growback to summary
private void grow(int l)
setback to summary
public int set(int i, int val)

Sets the value at index i to val.

Parameters
i:int

the 0 - based index.

val:int

the new value.

Returns:int

the old value.

Exceptions
ArrayIndexOutOfBoundsException:
if i < 0 or i >= size().
sizeback to summary
public int size()

Gets the number of int values stored.

toArrayback to summary
public int[] toArray()

Creates a int[] object with all the elements.