weka.gui.simplecli
Class AbstractCommand
- java.lang.Object
-
- weka.gui.simplecli.AbstractCommand
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable<AbstractCommand>
- Direct Known Subclasses:
- Capabilities, Cls, Echo, Exit, Help, History, Java, Kill, Script, Set, Unset
public abstract class AbstractCommand extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<AbstractCommand>
Ancestor for command.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description AbstractCommand()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description intcompareTo(AbstractCommand o)Performs comparison just on the name.booleanequals(java.lang.Object obj)Returns true if the object is a command with the same name.voidexecute(java.lang.String[] params)Executes the command with the given parameters.static AbstractCommandgetCommand(java.lang.String name)Locates the command for the given name.static java.util.List<AbstractCommand>getCommands()Returns all available commands.abstract java.lang.StringgetHelp()Returns the help string (no indentation).abstract java.lang.StringgetName()Returns the name of the command.SimpleCLIPanelgetOwner()Returns the owner.abstract java.lang.StringgetParameterHelp()Returns the one-liner help string for the parameters.voidsetOwner(SimpleCLIPanel value)Sets the owner.
-
-
-
Method Detail
-
setOwner
public void setOwner(SimpleCLIPanel value)
Sets the owner.- Parameters:
value- the owner
-
getOwner
public SimpleCLIPanel getOwner()
Returns the owner.- Returns:
- the owner
-
getName
public abstract java.lang.String getName()
Returns the name of the command.- Returns:
- the name
-
getHelp
public abstract java.lang.String getHelp()
Returns the help string (no indentation).- Returns:
- the help
-
getParameterHelp
public abstract java.lang.String getParameterHelp()
Returns the one-liner help string for the parameters.- Returns:
- the help, empty if none available
-
execute
public void execute(java.lang.String[] params) throws java.lang.ExceptionExecutes the command with the given parameters. Expands any variables in the parameters.- Parameters:
params- the parameters for the command- Throws:
java.lang.Exception- if command fails
-
compareTo
public int compareTo(AbstractCommand o)
Performs comparison just on the name.- Specified by:
compareToin interfacejava.lang.Comparable<AbstractCommand>- Parameters:
o- the other command to compare with- Returns:
- less than, equal to, or greater than 0
- See Also:
getName()
-
equals
public boolean equals(java.lang.Object obj)
Returns true if the object is a command with the same name.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the other object to compare with- Returns:
- true if the same
-
getCommands
public static java.util.List<AbstractCommand> getCommands()
Returns all available commands.- Returns:
- the commands
-
getCommand
public static AbstractCommand getCommand(java.lang.String name)
Locates the command for the given name.- Parameters:
name- the command to look for- Returns:
- the command, null if not found
-
-
DataMelt 3.0 © DataMelt by jWork.ORG