Class CallStack

java.lang.Object
org.rapidcontext.core.proc.CallStack

public class CallStack extends Object
A procedure call stack. The stack contains an ordered list of the procedures currently being called.
Version:
1.0
  • Constructor Details

    • CallStack

      public CallStack()
      Creates a new empty procedure call stack.
  • Method Details

    • contains

      public boolean contains(Procedure proc)
      Checks if the specified procedure exists in the call stack.
      Parameters:
      proc - the procedure definition
      Returns:
      true if the procedure exists in the call stack, or false otherwise
    • height

      public int height()
      Returns the current height of the call stack.
      Returns:
      the current height of the call stack
    • bottom

      public Procedure bottom()
      Returns the bottom procedure in the stack, i.e. the first procedure in the call chain.
      Returns:
      the bottom procedure in the stack, or null if the stack is empty
    • top

      public Procedure top()
      Returns the top procedure in the stack, i.e. the last procedure in the call chain.
      Returns:
      the top procedure in the stack, or null if the stack is empty
    • toArray

      public Procedure[] toArray()
      Returns all procedures on the stack in an array.
      Returns:
      an array with all the procedures on the stack