Package com.biglybt.ui.console.commands
Class CommandCollection
- java.lang.Object
-
- com.biglybt.ui.console.commands.CommandCollection
-
public class CommandCollection extends java.lang.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 Summary
Fields Modifier and Type Field Description private java.util.Map
subCommands
-
Constructor Summary
Constructors Constructor Description CommandCollection()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(IConsoleCommand command)
adds the specified console command as a subcommand to this object.void
execute(java.lang.String commandName, ConsoleInput ci, java.util.List args)
determines the appropriate subcommand to execute and then executes it, passing in the arguments that we receivedIConsoleCommand
get(java.lang.String commandName)
returns the sub command with the specified command namejava.lang.String
getCommandDescriptions()
constructs a string with the descriptions of all of the subcommands, each separated by a newlinejava.util.Iterator
iterator()
gets the set of IConsoleCommand objects that are all of the subcommands that this object owns
-
-
-
Method Detail
-
execute
public void execute(java.lang.String commandName, ConsoleInput ci, java.util.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 java.lang.String getCommandDescriptions()
constructs a string with the descriptions of all of the subcommands, each separated by a newline- Returns:
-
get
public IConsoleCommand get(java.lang.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 java.util.Iterator iterator()
gets the set of IConsoleCommand objects that are all of the subcommands that this object owns- Returns:
-
-