Package org.antlr.runtime.misc
Class IntArray
java.lang.Object
org.antlr.runtime.misc.IntArray
A dynamic array that uses int not Integer objects. In principle this
is more efficient in time, but certainly in space.
This is simple enough that you can access the data array directly,
but make sure that you append elements only with add() so that you
get dynamic sizing. Make sure to call ensureCapacity() when you are
manually adding new elements.
Doesn't impl List because it doesn't return objects and I mean this
really as just an array not a List per se. Manipulate the elements
at will. This has stack methods too.
When runtime can be 1.5, I'll make this generic.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
INITIAL_SIZE
public static final int INITIAL_SIZE- See Also:
-
data
public int[] data -
p
protected int p
-
-
Constructor Details
-
IntArray
public IntArray()
-
-
Method Details
-
add
public void add(int v) -
push
public void push(int v) -
pop
public int pop() -
size
public int size()This only tracks elements added via push/add. -
clear
public void clear() -
ensureCapacity
public void ensureCapacity(int index)
-