|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xml.utils.ObjectVector org.apache.xml.utils.ObjectStack
public class ObjectStack
Implement a stack of simple integers. %OPT% This is currently based on ObjectVector, 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 ChunkedObjectVector.
Field Summary |
---|
Fields inherited from class org.apache.xml.utils.ObjectVector |
---|
m_blocksize, m_firstFree, m_map, m_mapSize |
Constructor Summary | |
---|---|
ObjectStack()
Default constructor. |
|
ObjectStack(int blocksize)
Construct a ObjectVector, using the given block size. |
|
ObjectStack(ObjectStack v)
Copy constructor for ObjectStack |
Method Summary | |
---|---|
java.lang.Object |
clone()
Returns clone of current ObjectStack |
boolean |
empty()
Tests if this stack is empty. |
java.lang.Object |
peek()
Looks at the object at the top of this stack without removing it from the stack. |
java.lang.Object |
peek(int n)
Looks at the object at the position the stack counting down n items. |
java.lang.Object |
pop()
Removes the object at the top of this stack and returns that object as the value of this function. |
java.lang.Object |
push(java.lang.Object 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(java.lang.Object o)
Returns where an object is on this stack. |
void |
setTop(java.lang.Object val)
Sets an object at a the top of the statck |
Methods inherited from class org.apache.xml.utils.ObjectVector |
---|
addElement, addElements, addElements, contains, elementAt, indexOf, indexOf, insertElementAt, lastIndexOf, removeAllElements, removeElement, removeElementAt, setElementAt, setSize, setToSize, size |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ObjectStack()
public ObjectStack(int blocksize)
blocksize
- Size of block to allocatepublic ObjectStack(ObjectStack v)
v
- ObjectStack to copyMethod Detail |
---|
public java.lang.Object push(java.lang.Object i)
i
- the int to be pushed onto this stack.
item
argument.public java.lang.Object pop()
public void quickPop(int n)
public java.lang.Object peek()
java.util.EmptyStackException
- if this stack is empty.public java.lang.Object peek(int n)
n
- The number of items down, indexed from zero.
java.util.EmptyStackException
- if this stack is empty.public void setTop(java.lang.Object val)
val
- object to set at the top
java.util.EmptyStackException
- if this stack is empty.public boolean empty()
true
if this stack is empty;
false
otherwise.public int search(java.lang.Object o)
o
- the desired object.
-1
indicates that the
object is not on the stack.public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class ObjectVector
java.lang.CloneNotSupportedException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |