|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.antlr.runtime.misc.IntArray
public class 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 | |
---|---|
int[] |
data
|
static int |
INITIAL_SIZE
|
protected int |
p
|
Constructor Summary | |
---|---|
IntArray()
|
Method Summary | |
---|---|
void |
add(int v)
|
void |
clear()
|
void |
ensureCapacity(int index)
|
int |
pop()
|
void |
push(int v)
|
int |
size()
This only tracks elements added via push/add. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int INITIAL_SIZE
public int[] data
protected int p
Constructor Detail |
---|
public IntArray()
Method Detail |
---|
public void add(int v)
public void push(int v)
public int pop()
public int size()
public void clear()
public void ensureCapacity(int index)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |