Class UnitPlan<C>

java.lang.Object
dev.engine_room.flywheel.lib.task.UnitPlan<C>
All Implemented Interfaces:
Plan<C>

public final class UnitPlan<C> extends Object implements Plan<C>
  • Method Details

    • of

      public static <C> UnitPlan<C> of()
    • execute

      public void execute(TaskExecutor taskExecutor, C context, Runnable onCompletion)
      Description copied from interface: Plan
      Submit this plan for execution.

      You must call onCompletion.run() when the plan has completed execution.

      Specified by:
      execute in interface Plan<C>
      Parameters:
      taskExecutor - The executor to use for submitting tasks.
      context - An arbitrary context object that the plan wants to use at runtime.
      onCompletion - A callback to run when the plan has completed execution, useful for chaining plans.
    • then

      public Plan<C> then(Plan<C> plan)
      Description copied from interface: Plan
      Create a new plan that executes this plan, then the given plan.
      Specified by:
      then in interface Plan<C>
      Parameters:
      plan - The plan to execute after this plan.
      Returns:
      The composed plan.
    • and

      public Plan<C> and(Plan<C> plan)
      Description copied from interface: Plan
      Create a new plan that executes this plan and the given plan in parallel.
      Specified by:
      and in interface Plan<C>
      Parameters:
      plan - The plan to execute in parallel with this plan.
      Returns:
      The composed plan.