org.apache.xml.utils
Class IntStack
- Cloneable
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.
Object | clone() - Returns clone of current IntStack
|
boolean | empty() - Tests if this stack is empty.
|
int | peek() - Looks at the object at the top of this stack without removing it
from the stack.
|
int | peek(int n) - Looks at the object at the position the stack counting down n items.
|
int | pop() - Removes the object at the top of this stack and returns that
object as the value of this function.
|
int | push(int i) - Pushes an item onto the top of this stack.
|
void | quickPop(int n) - Quickly pops a number of items from the stack.
|
int | search(int o) - Returns where an object is on this stack.
|
void | setTop(int val) - Sets an object at a the top of the statck
|
addElement , addElements , addElements , clone , contains , elementAt , indexOf , indexOf , insertElementAt , lastIndexOf , removeAllElements , removeElement , removeElementAt , setElementAt , setSize , size |
IntStack
public IntStack()
Default constructor. Note that the default
block size is very small, for small lists.
IntStack
public IntStack(int blocksize)
Construct a IntVector, using the given block size.
blocksize
- Size of block to allocate
IntStack
public IntStack(IntStack v)
Copy constructor for IntStack
clone
public Object clone()
throws CloneNotSupportedException
Returns clone of current IntStack
- clone in interface IntVector
- clone of current IntStack
empty
public boolean empty()
Tests if this stack is empty.
true
if this stack is empty;
false
otherwise.
peek
public final int peek()
Looks at the object at the top of this stack without removing it
from the stack.
- the object at the top of this stack.
peek
public int peek(int n)
Looks at the object at the position the stack counting down n items.
n
- The number of items down, indexed from zero.
- the object at n items down.
pop
public final int pop()
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)
Pushes an item onto the top of this stack.
i
- the int to be pushed onto this stack.
quickPop
public final void quickPop(int n)
Quickly pops a number of items from the stack.
search
public int search(int o)
Returns where an object is on this stack.
- the distance from the top of the stack where the object is]
located; the return value
-1
indicates that the
object is not on the stack.
setTop
public void setTop(int val)
Sets an object at a the top of the statck
val
- object to set at the top
Copyright B) 2004 Apache XML Project. All Rights Reserved.