Top Description Fields Constructors Methods
com.sun.org.apache.xml.internal.utils

public Class IntStack

extends IntVector
Class Inheritance
Imports
java.util.EmptyStackException

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.

Field Summary

Inherited from com.sun.org.apache.xml.internal.utils.IntVector:
m_blocksizem_firstFreem_mapm_mapSize

Constructor Summary

AccessConstructor and Description
public
IntStack()

Default constructor.

public
IntStack(int
Size of block to allocate
blocksize
)

Construct a IntVector, using the given block size.

public
IntStack(IntStack
IntStack to copy
v
)

Copy constructor for IntStack

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

clone of current IntStack
clone
()

Overrides com.sun.org.apache.xml.internal.utils.IntVector.clone.

Returns clone of current IntStack

public boolean

Returns:

true if this stack is empty; false otherwise.
empty
()

Tests if this stack is empty.

public final int

Returns:

the object at the top of this stack.
peek
()

Looks at the object at the top of this stack without removing it from the stack.

public int

Returns:

the object at n items down.
peek
(int
The number of items down, indexed from zero.
n
)

Looks at the object at the position the stack counting down n items.

public final int

Returns:

The object at the top of this stack.
pop
()

Removes the object at the top of this stack and returns that object as the value of this function.

public int

Returns:

the item argument.
push
(int
the int to be pushed onto this stack.
i
)

Pushes an item onto the top of this stack.

public final void
quickPop(int n)

Quickly pops a number of items from the stack.

public int

Returns:

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.
search
(int
the desired object.
o
)

Returns where an object is on this stack.

public void
setTop(int
object to set at the top
val
)

Sets an object at a the top of the statck

Inherited from com.sun.org.apache.xml.internal.utils.IntVector:
addElementaddElementsaddElementscontainselementAtindexOfindexOfinsertElementAtlastIndexOfremoveAllElementsremoveElementremoveElementAtsetElementAtsetSizesize

Constructor Detail

IntStackback to summary
public IntStack()

Default constructor. Note that the default block size is very small, for small lists.

IntStackback to summary
public IntStack(int blocksize)

Construct a IntVector, using the given block size.

Parameters
blocksize:int

Size of block to allocate

IntStackback to summary
public IntStack(IntStack v)

Copy constructor for IntStack

Parameters
v:IntStack

IntStack to copy

Method Detail

cloneback to summary
public Object clone() throws CloneNotSupportedException

Overrides com.sun.org.apache.xml.internal.utils.IntVector.clone.

Returns clone of current IntStack

Returns:Object

clone of current IntStack

Exceptions
CloneNotSupportedException:

Doc from java.lang.Object.clone.

if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.

emptyback to summary
public boolean empty()

Tests if this stack is empty.

Returns:boolean

true if this stack is empty; false otherwise.

Since
JDK1.0
peekback to summary
public final int peek()

Looks at the object at the top of this stack without removing it from the stack.

Returns:int

the object at the top of this stack.

Exceptions
EmptyStackException:
if this stack is empty.
peekback to summary
public int peek(int n)

Looks at the object at the position the stack counting down n items.

Parameters
n:int

The number of items down, indexed from zero.

Returns:int

the object at n items down.

Exceptions
EmptyStackException:
if this stack is empty.
popback to summary
public final int pop()

Removes the object at the top of this stack and returns that object as the value of this function.

Returns:int

The object at the top of this stack.

pushback to summary
public int push(int i)

Pushes an item onto the top of this stack.

Parameters
i:int

the int to be pushed onto this stack.

Returns:int

the item argument.

quickPopback to summary
public final void quickPop(int n)

Quickly pops a number of items from the stack.

searchback to summary
public int search(int o)

Returns where an object is on this stack.

Parameters
o:int

the desired object.

Returns:int

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.

Since
JDK1.0
setTopback to summary
public void setTop(int val)

Sets an object at a the top of the statck

Parameters
val:int

object to set at the top

Exceptions
EmptyStackException:
if this stack is empty.