Class SimulatedStack<T>

  • Type Parameters:
    T - Content-type of the stacks contents
    All Implemented Interfaces:
    Serializable

    public class SimulatedStack<T>
    extends Object
    implements Serializable
    A simulated stack used by simulation threads to store their local variables during their execution
    See Also:
    Serialized Form
    • Constructor Detail

      • SimulatedStack

        public SimulatedStack()
    • Method Detail

      • createAndPushNewStackFrame

        public SimulatedStackframe<T> createAndPushNewStackFrame()
        Add a stackframe to this stack. The frame has no parent frame.
        Returns:
        The frame added by this method
      • createAndPushNewStackFrame

        public SimulatedStackframe<T> createAndPushNewStackFrame​(SimulatedStackframe<T> parent)
        Add a stackframe to this stack using the given frame as parent frame
        Parameters:
        parent - The parent frame of the frame to create
        Returns:
        The newly created frame
      • currentStackFrame

        public SimulatedStackframe<T> currentStackFrame()
        Returns:
        Topmost stackframe on this stack
      • removeStackFrame

        public void removeStackFrame()
        Pop the topmost stackframe. Called when exiting a scope
      • size

        public int size()
        Returns:
        Size of the stack
      • pushStackFrame

        public void pushStackFrame​(SimulatedStackframe<T> copyFrame)
        Add a stackframe on top of this stack. The frame already exists.
        Parameters:
        copyFrame - The frame to push on the stack