Record Class BarrierPlan<C>

java.lang.Object
java.lang.Record
dev.engine_room.flywheel.lib.task.BarrierPlan<C>
All Implemented Interfaces:
Plan<C>, SimplyComposedPlan<C>

public record BarrierPlan<C>(Plan<C> first, Plan<C> second) extends Record implements SimplyComposedPlan<C>
  • Constructor Summary

    Constructors
    Constructor
    Description
    BarrierPlan(Plan<C> first, Plan<C> second)
    Creates an instance of a BarrierPlan record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    void
    execute(TaskExecutor taskExecutor, C context, Runnable onCompletion)
    Submit this plan for execution.
    Returns the value of the first record component.
    final int
    Returns a hash code value for this object.
    static <C> BarrierPlan<C>
    of(Plan<C> first, Plan<C> second)
     
    Returns the value of the second record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface dev.engine_room.flywheel.api.task.Plan

    execute

    Methods inherited from interface dev.engine_room.flywheel.lib.task.SimplyComposedPlan

    and, then
  • Constructor Details

    • BarrierPlan

      public BarrierPlan(Plan<C> first, Plan<C> second)
      Creates an instance of a BarrierPlan record class.
      Parameters:
      first - the value for the first record component
      second - the value for the second record component
  • Method Details

    • of

      public static <C> BarrierPlan<C> of(Plan<C> first, Plan<C> second)
    • 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.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • first

      public Plan<C> first()
      Returns the value of the first record component.
      Returns:
      the value of the first record component
    • second

      public Plan<C> second()
      Returns the value of the second record component.
      Returns:
      the value of the second record component