Package org.apache.uima.internal.util
Class IntStack
java.lang.Object
org.apache.uima.internal.util.IntVector
org.apache.uima.internal.util.IntStack
- All Implemented Interfaces:
Serializable
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:
-
Field Summary
-
Constructor Summary
-
Method Summary
Methods inherited from class org.apache.uima.internal.util.IntVector
add, add, add, add, addBulk, contains, copy, copyFromArray, copyToArray, ensure_size, equals, fill, get, getArray, hashCode, indexOf, indexOfOptimizeAscending, intListIterator, iterator, lastIndexOf, multiAdd, multiAdd, position, put, remove, removeAllElements, removeAllElementsAdjustSizeDown, resetSize, set, setSize, size, sort, sortDedup, toArray, toArrayCopy, toIntArray, toString, trimToSize
-
Constructor Details
-
IntStack
public IntStack()Creates an empty stack. -
IntStack
public IntStack(int capacity) Creates an empty stack.- Parameters:
capacity
- -
-
IntStack
public IntStack(int capacity, int growth_factor, int multiplication_limit) Creates an empty stack with specified capacity, growth_factor and multiplication limit- Parameters:
capacity
- -growth_factor
- -multiplication_limit
- -
-
-
Method Details
-
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.
-