| java.lang.Object org.apache.xml.utils.IntVector org.apache.xml.utils.IntStack
IntStack | public class IntStack extends IntVector (Code) | | Implement a stack of simple integers.
%OPT%
This is currently based on IntVector, which permits fast acess but pays a
heavy recopying penalty if/when its size is increased. If we expect deep
stacks, we should consider a version based on ChunkedIntVector.
|
Constructor Summary | |
public | IntStack() Default constructor. | public | IntStack(int blocksize) Construct a IntVector, using the given block size. | public | IntStack(IntStack v) |
Method Summary | |
public Object | clone() | public boolean | empty() Tests if this stack is empty. | final public int | peek() Looks at the object at the top of this stack without removing it
from the stack. | public int | peek(int n) Looks at the object at the position the stack counting down n items.
Parameters: n - The number of items down, indexed from zero. | final public int | pop() Removes the object at the top of this stack and returns that
object as the value of this function. | public int | push(int i) Pushes an item onto the top of this stack.
Parameters: i - the int to be pushed onto this stack. | final public void | quickPop(int n) Quickly pops a number of items from the stack. | public int | search(int o) Returns where an object is on this stack.
Parameters: o - the desired object. | public void | setTop(int val) |
IntStack | public IntStack()(Code) | | Default constructor. Note that the default
block size is very small, for small lists.
|
IntStack | public IntStack(int blocksize)(Code) | | Construct a IntVector, using the given block size.
Parameters: blocksize - Size of block to allocate |
IntStack | public IntStack(IntStack v)(Code) | | Copy constructor for IntStack
Parameters: v - IntStack to copy |
empty | public boolean empty()(Code) | | Tests if this stack is empty.
true if this stack is empty;false otherwise. since: JDK1.0 |
peek | final public int peek()(Code) | | Looks at the object at the top of this stack without removing it
from the stack.
the object at the top of this stack. throws: EmptyStackException - if this stack is empty. |
peek | public int peek(int n)(Code) | | Looks at the object at the position the stack counting down n items.
Parameters: n - The number of items down, indexed from zero. the object at n items down. throws: EmptyStackException - if this stack is empty. |
pop | final public int pop()(Code) | | Removes the object at the top of this stack and returns that
object as the value of this function.
The object at the top of this stack. |
push | public int push(int i)(Code) | | Pushes an item onto the top of this stack.
Parameters: i - the int to be pushed onto this stack. the item argument. |
quickPop | final public void quickPop(int n)(Code) | | Quickly pops a number of items from the stack.
|
search | public int search(int o)(Code) | | Returns where an object is on this stack.
Parameters: o - the desired object. the distance from the top of the stack where the object is]located; the return value -1 indicates that theobject is not on the stack. since: JDK1.0 |
setTop | public void setTop(int val)(Code) | | Sets an object at a the top of the statck
Parameters: val - object to set at the top throws: EmptyStackException - if this stack is empty. |
|
|