caoss.simulator.console

## Class ConsoleCommand

- java.lang.Object
- - caoss.simulator.console.ConsoleCommand

- Direct Known Subclasses:
    ExecCommand, HelpCommand, RealTimeExecCommand, ResetStatsCommand, SaveStatsCommand, ShutdownCommand

      public abstract class ConsoleCommand
      extends java.lang.Object

  Base class for the implementation of console commands
  Author:
    Herve Paulino

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConsoleCommand()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `checkNumberArguments(int numberOfArguments)` Checks if the given number of arguments abides to the command's specification
    `abstract java.lang.String` | `getCommandName()` The name that the user must use to invoke the command
    `abstract int` | `getNumberArguments()` Obtain the command's number of mandatory arguments
    `abstract int` | `getNumberOptionalArguments()` Obtain the command's number of optional arguments
    `abstract void` | `run(java.util.List<java.lang.String> arguments)` The implementation of the command
    `abstract java.lang.String` | `usage()` A string representation of the command's usage.

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

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

- - ### Constructor Detail

    - #### ConsoleCommand

          public ConsoleCommand()

  - ### Method Detail

    - #### getCommandName

          public abstract java.lang.String getCommandName()

      The name that the user must use to invoke the command
      Returns:
        The name of the command

    - #### run

          public abstract void run(java.util.List<java.lang.String> arguments)

      The implementation of the command
      Parameters:
        `arguments` - List of arguments that the command receives

    - #### getNumberArguments

          public abstract int getNumberArguments()

      Obtain the command's number of mandatory arguments
      Returns:
        The number of arguments

    - #### getNumberOptionalArguments

          public abstract int getNumberOptionalArguments()

      Obtain the command's number of optional arguments
      Returns:
        The number of arguments

    - #### usage

          public abstract java.lang.String usage()

      A string representation of the command's usage. Posted by the console's `help` command.
      Returns:
        The string representation of the command's usage.

    - #### checkNumberArguments

          public boolean checkNumberArguments(int numberOfArguments)

      Checks if the given number of arguments abides to the command's specification
      Parameters:
        `numberOfArguments` - Number of arguments to check
      Returns:
        true if the number of arguments is valid, false otherwise