|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jibx.runtime.IntStack
public class IntStack
Growable int
stack with type specific access methods. This
implementation is unsynchronized in order to provide the best possible
performance for typical usage scenarios, so explicit synchronization must
be implemented by a wrapper class or directly by the application in cases
where instances are modified in a multithreaded environment. See the base
classes for other details of the implementation.
Field Summary | |
---|---|
static int |
DEFAULT_SIZE
Default initial array size. |
Constructor Summary | |
---|---|
IntStack()
Default constructor. |
|
IntStack(int size)
Constructor with initial size specified. |
|
IntStack(int[] ints)
Constructor from array of ints. |
|
IntStack(int size,
int growth)
Constructor with full specification. |
|
IntStack(IntStack base)
Copy (clone) constructor. |
Method Summary | |
---|---|
void |
clear()
Set the stack to the empty state. |
java.lang.Object |
clone()
Duplicates the object with the generic call. |
void |
ensureCapacity(int min)
Ensure that the array has the capacity for at least the specified number of values. |
boolean |
isEmpty()
Check if stack is empty. |
int |
peek()
Copy top value from the stack. |
int |
peek(int depth)
Copy a value from the stack. |
int |
pop()
Pop a value from the stack. |
int |
pop(int count)
Pop multiple values from the stack. |
void |
push(int value)
Push a value on the stack. |
int |
size()
Get the number of values currently present in the stack. |
int[] |
toArray()
Constructs and returns a simple array containing the same data as held in this stack. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_SIZE
Constructor Detail |
---|
public IntStack(int size, int growth)
size
- number of int
values initially allowed in
stackgrowth
- maximum size increment for growing stackpublic IntStack(int size)
size
- number of int
values initially allowed in
stackpublic IntStack()
public IntStack(IntStack base)
base
- instance being copiedpublic IntStack(int[] ints)
ints
- array of ints for initial contentsMethod Detail |
---|
public final void ensureCapacity(int min)
min
- minimum capacity to be guaranteedpublic void push(int value)
value
- value to be addedpublic int pop()
java.lang.ArrayIndexOutOfBoundsException
- on attempt to pop empty stackpublic int pop(int count)
count
- number of values to pop from stack (must be strictly
positive)
java.lang.ArrayIndexOutOfBoundsException
- on attempt to pop past end of
stackpublic int peek(int depth)
depth
- depth of value to be returned
java.lang.ArrayIndexOutOfBoundsException
- on attempt to peek past end of
stackpublic int peek()
java.lang.ArrayIndexOutOfBoundsException
- on attempt to peek empty stackpublic int[] toArray()
public java.lang.Object clone()
clone
in class java.lang.Object
public int size()
public boolean isEmpty()
true
if stack empty, false
if notpublic void clear()
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |