|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jibx.binding.util.ObjectStack
public class ObjectStack
Growable Object 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.
| Field Summary | |
|---|---|
static int |
DEFAULT_SIZE
Default initial array size. |
protected Object[] |
m_baseArray
The underlying array used for storing the data. |
protected int |
m_countLimit
Size of the current array. |
protected int |
m_countPresent
The number of values currently present in the stack. |
protected int |
m_maximumGrowth
Maximum size increment for growing array. |
| Constructor Summary | |
|---|---|
ObjectStack()
Default constructor. |
|
ObjectStack(int size)
Constructor with initial size specified. |
|
ObjectStack(int size,
int growth)
Constructor with full specification. |
|
ObjectStack(Object[] strings)
Constructor from array of strings. |
|
ObjectStack(ObjectStack base)
Copy (clone) constructor. |
|
| Method Summary | |
|---|---|
void |
clear()
Set the stack to the empty state. |
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. |
Object |
peek()
Copy top value from the stack. |
Object |
peek(int depth)
Copy a value from the stack. |
Object |
pop()
Pop a value from the stack. |
Object |
pop(int count)
Pop multiple values from the stack. |
void |
push(Object value)
Push a value on the stack. |
int |
size()
Get the number of values currently present in the stack. |
Object[] |
toArray()
Constructs and returns a simple array containing the same data as held in this stack. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_SIZE
protected int m_countLimit
protected int m_countPresent
protected int m_maximumGrowth
protected Object[] m_baseArray
| Constructor Detail |
|---|
public ObjectStack(int size,
int growth)
size - number of Object values initially allowed in
stackgrowth - maximum size increment for growing stackpublic ObjectStack(int size)
size - number of Object values initially allowed in
stackpublic ObjectStack()
public ObjectStack(ObjectStack base)
base - instance being copiedpublic ObjectStack(Object[] strings)
strings - array of strings for initial contents| Method Detail |
|---|
public final void ensureCapacity(int min)
min - minimum capacity to be guaranteedpublic void push(Object value)
value - value to be addedpublic Object pop()
ArrayIndexOutOfBoundsException - on attempt to pop empty stackpublic Object pop(int count)
count - number of values to pop from stack (must be strictly
positive)
ArrayIndexOutOfBoundsException - on attempt to pop past end of
stackpublic Object peek(int depth)
depth - depth of value to be returned
ArrayIndexOutOfBoundsException - on attempt to peek past end of
stackpublic Object peek()
ArrayIndexOutOfBoundsException - on attempt to peek empty stackpublic Object[] toArray()
public Object clone()
clone in class Objectpublic 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 | |||||||||