Package org.rapidcontext.core.proc
Class CallStack
java.lang.Object
org.rapidcontext.core.proc.CallStack
A procedure call stack. The stack contains an ordered list of the
procedures currently being called.
- Version:
- 1.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbottom()
Returns the bottom procedure in the stack, i.e.boolean
Checks if the specified procedure exists in the call stack.int
height()
Returns the current height of the call stack.toArray()
Returns all procedures on the stack in an array.top()
Returns the top procedure in the stack, i.e.
-
Constructor Details
-
CallStack
public CallStack()Creates a new empty procedure call stack.
-
-
Method Details
-
contains
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
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
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
Returns all procedures on the stack in an array.- Returns:
- an array with all the procedures on the stack
-