Interface MacroCommand

All Superinterfaces:
Command
All Known Implementing Classes:
ApplyOperator, OverrideAbstractSupport

public interface MacroCommand extends Command
A command that expands into a list of RegularCommands at execution time. The ExecutionEngine calls expand(Unit) when the command's Command.condition() is satisfied, then splices the result at the front of the queue.

MacroCommands must never be executed directly; attempting to call execute(Unit) throws UnsupportedOperationException.

  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    execute(Unit context)
     
    expand(Unit context)
    Expands this macro into a sequence of atomic commands to be executed in order.

    Methods inherited from interface Command

    condition
  • Method Details

    • expand

      List<Command> expand(Unit context)
      Expands this macro into a sequence of atomic commands to be executed in order.
      Parameters:
      context - the current unit, available to inspect model state.
      Returns:
      the list of commands to splice into the execution queue.
    • execute

      default void execute(Unit context)
      Specified by:
      execute in interface Command