Class CommandExecutionCoordinator<C>

  • Type Parameters:
    C - Command sender type
    Direct Known Subclasses:
    AsynchronousCommandExecutionCoordinator, CommandExecutionCoordinator.SimpleCoordinator

    public abstract class CommandExecutionCoordinator<C>
    extends java.lang.Object
    The command execution coordinator is responsible for coordinating command execution. This includes determining what thread the command should be executed on, whether or not command may be executed in parallel, etc.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  CommandExecutionCoordinator.SimpleCoordinator<C>
      A simple command execution coordinator that executes all commands immediately, on the calling thread
    • Method Summary

      Modifier and Type Method Description
      abstract @NonNull java.util.concurrent.CompletableFuture<CommandResult<C>> coordinateExecution​(@NonNull CommandContext<C> commandContext, @NonNull java.util.Queue<@NonNull java.lang.String> input)
      Coordinate the execution of a command and return the result
      protected @NonNull CommandTree<C> getCommandTree()
      Get the command tree
      static <C> @NonNull java.util.function.Function<@NonNull CommandTree<C>,​@NonNull CommandExecutionCoordinator<C>> simpleCoordinator()
      Returns a simple command execution coordinator that executes all commands immediately, on the calling thread
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CommandExecutionCoordinator

        protected CommandExecutionCoordinator​(@NonNull CommandTree<C> commandTree)
        Construct a new command execution coordinator
        Parameters:
        commandTree - Command tree
    • Method Detail

      • simpleCoordinator

        public static <C> @NonNull java.util.function.Function<@NonNull CommandTree<C>,​@NonNull CommandExecutionCoordinator<C>> simpleCoordinator()
        Returns a simple command execution coordinator that executes all commands immediately, on the calling thread
        Type Parameters:
        C - Command sender type
        Returns:
        New coordinator instance
      • coordinateExecution

        public abstract @NonNull java.util.concurrent.CompletableFuture<CommandResult<C>> coordinateExecution​(@NonNull CommandContext<C> commandContext,
                                                                                                              @NonNull java.util.Queue<@NonNull java.lang.String> input)
        Coordinate the execution of a command and return the result
        Parameters:
        commandContext - Command context
        input - Command input
        Returns:
        Future that completes with the result
      • getCommandTree

        protected @NonNull CommandTree<C> getCommandTree()
        Get the command tree
        Returns:
        Command tree