org.apache.uima.internal.util
Class IntStack

java.lang.Object
  extended by org.apache.uima.internal.util.IntVector
      extended by org.apache.uima.internal.util.IntStack
All Implemented Interfaces:
java.io.Serializable

public class IntStack
extends IntVector

A stack of integers. Follows Stack pretty closely, except that push() returns the position of the added element in the stack. Inherits from IntVector, so those methods are also available.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.uima.internal.util.IntVector
array, pos
 
Constructor Summary
IntStack()
          Creates an empty stack.
IntStack(int capacity)
          Creates an empty stack.
IntStack(int capacity, int growth_factor, int multiplication_limit)
          Creates an empty stack with specified capacity, growth_factor and multiplication limit
 
Method Summary
 void clear()
          Clears the stack.
 boolean empty()
          Check if stack is empty.
 int peek()
          Look at the topmost element in the stack.
 int pop()
          Pop an element from the stack.
 int push(int i)
          Push a new element on the stack.
 
Methods inherited from class org.apache.uima.internal.util.IntVector
add, add, contains, copy, ensure_size, equals, fill, get, getArray, hashCode, indexOf, position, put, remove, removeAllElements, set, setSize, size, toArray, toArrayCopy, toString, trimToSize
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntStack

public IntStack()
Creates an empty stack.


IntStack

public IntStack(int capacity)
Creates an empty stack.


IntStack

public IntStack(int capacity,
                int growth_factor,
                int multiplication_limit)
Creates an empty stack with specified capacity, growth_factor and multiplication limit

Method Detail

push

public int push(int i)
Push a new element on the stack.

Parameters:
i - The element to be pushed.
Returns:
The position of i after it's been added.

pop

public int pop()
Pop an element from the stack.

Returns:
The popped element.

peek

public int peek()
Look at the topmost element in the stack.

Returns:
The top element.

empty

public boolean empty()
Check if stack is empty.

Returns:
true, if stack is empty; false, else.

clear

public void clear()
Clears the stack. The amount of space reserved for this stack remains unchanged.



Copyright © 2010 The Apache Software Foundation. All Rights Reserved.