Package weka.gui.simplecli
Class AbstractCommand
java.lang.Object
weka.gui.simplecli.AbstractCommand
- All Implemented Interfaces:
Serializable,Comparable<AbstractCommand>
- Direct Known Subclasses:
Capabilities,Cls,Echo,Exit,Help,History,Java,Kill,Script,Set,Unset
public abstract class AbstractCommand
extends Object
implements Serializable, Comparable<AbstractCommand>
Ancestor for command.
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintPerforms comparison just on the name.booleanReturns true if the object is a command with the same name.voidExecutes the command with the given parameters.static AbstractCommandgetCommand(String name) Locates the command for the given name.static List<AbstractCommand>Returns all available commands.abstract StringgetHelp()Returns the help string (no indentation).abstract StringgetName()Returns the name of the command.getOwner()Returns the owner.abstract StringReturns the one-liner help string for the parameters.voidsetOwner(SimpleCLIPanel value) Sets the owner.
-
Constructor Details
-
AbstractCommand
public AbstractCommand()
-
-
Method Details
-
setOwner
Sets the owner.- Parameters:
value- the owner
-
getOwner
Returns the owner.- Returns:
- the owner
-
getName
Returns the name of the command.- Returns:
- the name
-
getHelp
Returns the help string (no indentation).- Returns:
- the help
-
getParameterHelp
Returns the one-liner help string for the parameters.- Returns:
- the help, empty if none available
-
execute
Executes the command with the given parameters. Expands any variables in the parameters.- Parameters:
params- the parameters for the command- Throws:
Exception- if command fails
-
compareTo
Performs comparison just on the name.- Specified by:
compareToin interfaceComparable<AbstractCommand>- Parameters:
o- the other command to compare with- Returns:
- less than, equal to, or greater than 0
- See Also:
-
equals
Returns true if the object is a command with the same name. -
getCommands
Returns all available commands.- Returns:
- the commands
-
getCommand
Locates the command for the given name.- Parameters:
name- the command to look for- Returns:
- the command, null if not found
-