Package mgui.command

Class CommandInterpreter

java.lang.Object
mgui.command.CommandInterpreter
Direct Known Subclasses:
CommandInstance

public abstract class CommandInterpreter
extends java.lang.Object
Serves as the base class for command-line interpreters which interact with mgui.
Since:
1.0
Version:
1.0
Author:
Andrew Reid
  • Field Details

    • clock_start

      protected static long clock_start
    • elapsed

      protected long elapsed
    • instance_clock_start

      protected long instance_clock_start
    • success_status

      protected boolean success_status
    • instance_state

      protected CommandFunctions.ProcessState instance_state
  • Constructor Details

    • CommandInterpreter

      public CommandInterpreter()
  • Method Details

    • execute

      public CommandFunctions.ProcessState execute​(java.lang.String[] args) throws java.lang.Exception
      Executes a process, similar to main, but runs as an instance, and returns the elapsed time in milliseconds.
      Parameters:
      args -
      Returns:
      Throws:
      java.lang.Exception
    • getSuccessStatus

      public boolean getSuccessStatus()
    • setSuccessStatus

      protected void setSuccessStatus​(boolean status)
    • getParameters

      public static java.util.HashMap<java.lang.String,​java.lang.String> getParameters​(java.lang.String[] args)
      Extracts parameters from a list of arguments, such that a parameter is specified by a dash. A parameter followed by an argument without a dash is assigned that value. This method returns the parameters as a hash map, with the parameter names as keys pointing to their values.

      For instance:

      the argument series "-z" "-b" "value" would be placed in the hash map as [["z"->""],["b"->"value"]

      Parameters:
      args -
      Returns:
    • isNumeric

      protected static boolean isNumeric​(java.lang.String n)
    • startTimer

      protected static void startTimer()
    • getTimer

      protected static long getTimer()
    • startInstanceTimer

      protected void startInstanceTimer()
    • getInstanceTimer

      protected long getInstanceTimer()
    • stopInstanceTimer

      protected void stopInstanceTimer()