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 Summary

    Constructors
    Constructor
    Description
    Creates a new empty procedure call stack.
  • Method Summary

    Modifier and Type
    Method
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
    Use top(int) with stack height instead.
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    Replaced with org.rapidcontext.core.type.Procedure signature.
    boolean
    Checks if the specified procedure exists in the call stack.
    int
    Returns the current height of the call stack.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Use toStackTrace(int) instead.
    top()
    Deprecated, for removal: This API element is subject to removal in a future version.
    Use top(int) instead.
    top(int offset)
    Returns the most recent caller from the stack.
    toStackTrace(int maxSize)
    Returns a printable stack trace for debugging purposes.

    Methods inherited from class java.lang.Object

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

    • CallStack

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

    • contains

      @Deprecated(forRemoval=true) public boolean contains(Procedure proc)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Replaced with org.rapidcontext.core.type.Procedure signature.
      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
    • 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

      @Deprecated(forRemoval=true) public Procedure bottom()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use top(int) with stack height instead.
      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

      @Deprecated(forRemoval=true) public Procedure top()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use top(int) instead.
      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
    • top

      public Path top(int offset)
      Returns the most recent caller from the stack.
      Parameters:
      offset - the offset from the top (0 for top)
      Returns:
      the top caller in the stack, or null if the stack is empty
    • toArray

      @Deprecated(forRemoval=true) public Procedure[] toArray()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use toStackTrace(int) instead.
      Returns all procedures on the stack in an array.
      Returns:
      an array with all the procedures on the stack
    • toStackTrace

      public List<String> toStackTrace(int maxSize)
      Returns a printable stack trace for debugging purposes.
      Parameters:
      maxSize - the maximum stack trace length
      Returns:
      an array with all the procedures on the stack