java.lang.Object
com.wyu4.snowberryjam.compiler.data.BodyStack
All Implemented Interfaces:
ExecutableTask

public class BodyStack extends Object implements ExecutableTask
The stack that stores Snowberry Jam instructions
  • Field Details

    • logger

      private static final org.slf4j.Logger logger
    • DEBUGGING_ENABLED

      private static final AtomicBoolean DEBUGGING_ENABLED
    • id

      private final SourceId id
    • stack

      private final List<ExecutableTask> stack
  • Constructor Details

    • BodyStack

      public BodyStack(SourceId id)
      Create a new Stack object
      Parameters:
      id - The ID of the stack (doesn't affect how the stack executes its tasks.)
  • Method Details

    • setDebuggingEnabled

      public static void setDebuggingEnabled(boolean state)
    • addTask

      public void addTask(ExecutableTask element)
      Add an instruction into the stack
      Parameters:
      element - Element containing an instruction
    • copyStack

      public ExecutableTask[] copyStack()
      Get a deep copy of the stack
      Returns:
      An array of ExecutableTask
      See Also:
    • flush

      public void flush()
      Flush the contents of the stack
    • execute

      public void execute()
      Description copied from interface: ExecutableTask
      Run the task
      Specified by:
      execute in interface ExecutableTask
    • feedback

      public Object feedback()
      Description copied from interface: ExecutableTask
      Get some feedback from the task. Can be anything, depending on the task.
      Specified by:
      feedback in interface ExecutableTask
      Returns:
      Data parsed as Object
    • getId

      public SourceId getId()
      Description copied from interface: ExecutableTask
      Get the ID of the task
      Specified by:
      getId in interface ExecutableTask
      Returns:
      Corresponding SourceId