Class Coroutine.ForkResult

java.lang.Object
org.wpilib.command3.Coroutine.ForkResult
Enclosing class:
Coroutine

public final class Coroutine.ForkResult extends Object
Represents the result of a fork operation that attempts to schedule multiple commands concurrently. The class provides information about the success or failure of the fork operation as well as utility methods to handle the outcome.

Instances of this class are immutable and provide methods to access the details of the forked and failed commands.

  • Method Details

    • successful

      public boolean successful()
      Checks if the fork request was successful.
      Returns:
      True if no commands failed to be forked, false if at least one failed.
    • failed

      public boolean failed()
      Checks if the fork request failed.
      Returns:
      True if at least one command failed to be forked, false if all commands were successfully forked.
    • partialSuccess

      public boolean partialSuccess()
      Checks if the fork request was partially successful. A partial success is defined as at least one command being forked but at least one failing to be forked. This can happen if a child immediately schedules a grandchild with a higher priority than a later sibling that shares requirements with that grandchild.
      Returns:
      True if at least one command was forked but at least one failed to be forked, false if all commands were successfully forked or none were forked.
    • awaitCompletion

      public void awaitCompletion()
      Waits for all forked commands to complete. Unlike a fork-then-await pattern, which will reschedule any forked commands that already completed, awaitCompletion() will only wait for the forked commands that are still running.

      This method does nothing if no commands were successfully forked.

    • getFailedCommands

      public List<? extends Scheduler.ScheduleResult.Failure> getFailedCommands()
      Returns the list of commands that failed to be forked. This list is read-only and cannot be modified.
      Returns:
      The list of failed commands.
    • getForkedCommands

      public List<? extends Command> getForkedCommands()
      Returns the list of commands that were successfully forked. This list is read-only and cannot be modified.
      Returns:
      The list of forked commands.