Class IntArrayStack

java.lang.Object
org.parboiled.common.IntArrayStack

public class IntArrayStack extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Empties the stack.
    void
    getElements(int[] destArray, int destStartIndex)
    Copies all elements currently on the stack into the given array.
    boolean
    Tests if the stack is empty.
    int
    Returns the item at the top of the stack without removing it.
    int
    pop()
    Removes the most recently inserted item from the stack.
    void
    push(int x)
    Pushes a new item onto the stack.
    int
    Returns the number of element currently on the stack.
    int[]
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • IntArrayStack

      public IntArrayStack()
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Tests if the stack is empty.
      Returns:
      true if empty, false otherwise.
    • size

      public int size()
      Returns the number of element currently on the stack.
      Returns:
      the number of element currently on the stack
    • getElements

      public void getElements(int[] destArray, int destStartIndex)
      Copies all elements currently on the stack into the given array.
      Parameters:
      destArray - the array
      destStartIndex - the index to start copying into
    • toArray

      public int[] toArray()
      Returns:
      all elements in a new array.
    • clear

      public void clear()
      Empties the stack.
    • peek

      public int peek()
      Returns the item at the top of the stack without removing it.
      Returns:
      the most recently inserted item in the stack.
      Throws:
      IntArrayStack.UnderflowException - if the stack is empty.
    • pop

      public int pop()
      Removes the most recently inserted item from the stack.
      Returns:
      the top stack item
      Throws:
      IntArrayStack.UnderflowException - if the stack is empty.
    • push

      public void push(int x)
      Pushes a new item onto the stack.
      Parameters:
      x - the item to add.