|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jibx.util.StringStack
public class StringStack
Growable String 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. |
| Constructor Summary | |
|---|---|
StringStack()
Default constructor. |
|
StringStack(int size)
Constructor with initial size specified. |
|
StringStack(int size,
int growth)
Constructor with full specification. |
|
StringStack(String[] strings)
Constructor from array of strings. |
|
StringStack(StringStack 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. |
String |
peek()
Copy top value from the stack. |
String |
peek(int depth)
Copy a value from the stack. |
String |
pop()
Pop a value from the stack. |
String |
pop(int count)
Pop multiple values from the stack. |
void |
push(String value)
Push a value on the stack. |
int |
size()
Get the number of values currently present in the stack. |
String[] |
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
| Constructor Detail |
|---|
public StringStack(int size,
int growth)
size - number of String values initially allowed in
stackgrowth - maximum size increment for growing stackpublic StringStack(int size)
size - number of String values initially allowed in
stackpublic StringStack()
public StringStack(StringStack base)
base - instance being copiedpublic StringStack(String[] strings)
strings - array of strings for initial contents| Method Detail |
|---|
public final void ensureCapacity(int min)
min - minimum capacity to be guaranteedpublic void push(String value)
value - value to be addedpublic String pop()
ArrayIndexOutOfBoundsException - on attempt to pop empty stackpublic String pop(int count)
count - number of values to pop from stack (must be strictly
positive)
ArrayIndexOutOfBoundsException - on attempt to pop past end of
stackpublic String peek(int depth)
depth - depth of value to be returned
ArrayIndexOutOfBoundsException - on attempt to peek past end of
stackpublic String peek()
ArrayIndexOutOfBoundsException - on attempt to peek empty stackpublic String[] 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 | |||||||||