Class PlanMap<K,C>

java.lang.Object
dev.engine_room.flywheel.lib.task.PlanMap<K,C>
Type Parameters:
K - The key type
C - The context type
All Implemented Interfaces:
Plan<C>, SimplyComposedPlan<C>

public final class PlanMap<K,C> extends Object implements SimplyComposedPlan<C>
A plan that executes a dynamic list of plans in parallel.

The plans can be added/removed by association with a key object.

  • Constructor Details

    • PlanMap

      public PlanMap()
  • Method Details

    • add

      public void add(K object, Plan<C> plan)
    • remove

      public void remove(K object)
    • clear

      public void clear()
    • 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<K>
      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.