Class CommandCollection

java.lang.Object
com.biglybt.ui.console.commands.CommandCollection

public class CommandCollection extends Object
this class represents a collection of commands. it can be used by command objects to house their subcommands. when execute() method is called, the appropriate subcommand is looked up and executed
  • Field Details

    • subCommands

      private final Map subCommands
  • Constructor Details

    • CommandCollection

      public CommandCollection()
  • Method Details

    • execute

      public void execute(String commandName, ConsoleInput ci, List args)
      determines the appropriate subcommand to execute and then executes it, passing in the arguments that we received
      Parameters:
      commandName -
      ci -
      args -
    • getCommandDescriptions

      public String getCommandDescriptions()
      constructs a string with the descriptions of all of the subcommands, each separated by a newline
      Returns:
    • get

      public IConsoleCommand get(String commandName)
      returns the sub command with the specified command name
      Parameters:
      commandName -
      Returns:
    • add

      public void add(IConsoleCommand command)
      adds the specified console command as a subcommand to this object. we will therefore respond to all of the subcommands command names when passed as the first argument to this command
      Parameters:
      command -
    • iterator

      public Iterator iterator()
      gets the set of IConsoleCommand objects that are all of the subcommands that this object owns
      Returns: