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:
java.io.Serializable
public class IntStack extends IntVector
A stack of integers. FollowsStack
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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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, add, add, addBulk, contains, copy, ensure_size, equals, fill, get, getArray, hashCode, indexOf, indexOfOptimizeAscending, multiAdd, multiAdd, position, put, remove, removeAllElements, removeAllElementsAdjustSizeDown, resetSize, set, setSize, size, sortDedup, toArray, toArrayCopy, toIntArray, toString, trimToSize
-
-
-
-
Constructor Detail
-
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 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.
-
-