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:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractCommand()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `compareTo(AbstractCommand o)`
  Performs comparison just on the name.
  `boolean`
  `equals(Object obj)`
  Returns true if the object is a command with the same name.
  `void`
  `execute(String[] params)`
  Executes the command with the given parameters.
  `static AbstractCommand`
  `getCommand(String name)`
  Locates the command for the given name.
  `static List<AbstractCommand>`
  `getCommands()`
  Returns all available commands.
  `abstract String`
  `getHelp()`
  Returns the help string (no indentation).
  `abstract String`
  `getName()`
  Returns the name of the command.
  `SimpleCLIPanel`
  `getOwner()`
  Returns the owner.
  `abstract String`
  `getParameterHelp()`
  Returns the one-liner help string for the parameters.
  `void`
  `setOwner(SimpleCLIPanel value)`
  Sets the owner.

  ### Methods inherited from class java.lang.Object

  `getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### AbstractCommand

    public AbstractCommand()

- ## Method Details

  - ### 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 String getName()
    Returns the name of the command.
    Returns:
      the name

  - ### getHelp

    public abstract String getHelp()
    Returns the help string (no indentation).
    Returns:
      the help

  - ### getParameterHelp

    public abstract String getParameterHelp()
    Returns the one-liner help string for the parameters.
    Returns:
      the help, empty if none available

  - ### execute

    public void execute(String[] params) throws Exception
    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

    public int compareTo(AbstractCommand o)
    Performs comparison just on the name.
    Specified by:
      `compareTo` in interface `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(Object obj)
    Returns true if the object is a command with the same name.
    Overrides:
      `equals` in class `Object`
    Parameters:
      `obj` - the other object to compare with
    Returns:
      true if the same

  - ### getCommands

    public static List<AbstractCommand> getCommands()
    Returns all available commands.
    Returns:
      the commands

  - ### getCommand

    public static AbstractCommand getCommand(String name)
    Locates the command for the given name.
    Parameters:
      `name` - the command to look for
    Returns:
      the command, null if not found