Module FiCLI
Package fibrous.fi

Class FiCommand

java.lang.Object
fibrous.fi.FiCommand

public abstract class FiCommand extends Object
The base class which should be extended by all other commands. You must override the execute() method to perform whatever action that is needed. You must define the commandString (what input is needed to execute the command). Once a new command class has been created, it must be instantiated and added to the FiCLI. Whenever input is passed to the InputParser, if it matches the command string, the execute method will run. Define the String commandDescription to either provide help, show a description, or an example on how to use the command.
Author:
noahm
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    A list of arguments derived from the input.
    The description of the command.
     
    boolean
    Change this to false if you don't want a command to be listed.
  • Constructor Summary

    Constructors
    Constructor
    Description
    FiCommand(String commandString)
    You must determine what string this command will respond to (the commandString parameter).
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    Override this method to perform whatever function is needed.
    final boolean
    isCommand(String cString)
    Determines if the command that was passed matches the defined command string.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • commandString

      public String commandString
    • arguments

      public ArrayList<String> arguments
      A list of arguments derived from the input.
    • commandDescription

      public String commandDescription
      The description of the command. Shown when all of the commands are listed.
    • isVisible

      public boolean isVisible
      Change this to false if you don't want a command to be listed.
  • Constructor Details

    • FiCommand

      public FiCommand(String commandString)
      You must determine what string this command will respond to (the commandString parameter).
      Parameters:
      commandString -
  • Method Details

    • execute

      public abstract void execute()
      Override this method to perform whatever function is needed.
    • isCommand

      public final boolean isCommand(String cString)
      Determines if the command that was passed matches the defined command string. Fills the arguments ArrayList if it contains any arguments.
      Parameters:
      cString -
      Returns: