Class ExtensionsConsole


public class ExtensionsConsole extends FieldConsole
Console illustrating most of the features of jep extensions. Illustrates use of different fields, differentiation and symbolic operations, structured programming, matrix and statistical functions.

Since Jep 4.1 this now supports single quote strings and comments starting with a #. Dictionary creation and operations now supported through the MatrixDictComponents.

  • Constructor Details

    • ExtensionsConsole

      public ExtensionsConsole()
  • Method Details

    • initialise

      public void initialise()
      Description copied from class: Console
      sets up all the needed objects.
      Overrides:
      initialise in class FieldConsole
    • printIntroText

      public void printIntroText()
      Description copied from class: Console
      Prints introductory text.
      Overrides:
      printIntroText in class Console
    • printHelp

      public void printHelp()
      Description copied from class: Console
      Print help message.
      Overrides:
      printHelp in class FieldConsole
    • testSpecialCommands

      public Console.SPEC_ACTION testSpecialCommands(String command)
      Description copied from class: Console
      Checks for special commands. For example a subclass may have a verbose mode switched on of off using the command
       verbose on
       

      This method can be used detected this input, perform required actions and skip normal processing by returning true.

      In general subclasses should call the superclass methods to test for special commands that class implements

      Overrides:
      testSpecialCommands in class FieldConsole
      Parameters:
      command -
      Returns:
      One of
      • SPEC_ACTION.CONTINUE - continue parsing and evaluation this equation,
      • SPEC_ACTION.BREAK - stop processing this equation and add it to the history
      • SPEC_ACTION.EMPTY - stop processing this equation does not add it to the history
      • SPEC_ACTION.ALTERED - the input text has been altered, reprocess the new text
      • SPEC_ACTION.EXIT stop the program
      See Also:
    • setIndexShift

      public void setIndexShift(int i)
      Description copied from class: Console
      Set the index shift for arrays.
      Overrides:
      setIndexShift in class Console
      Parameters:
      i - the shift, either 0 or 1
    • finaliseCommand

      public boolean finaliseCommand(String command, Node node, Object res)
      Description copied from class: Console
      Perform any post-processing of a command after evaluation.
      Overrides:
      finaliseCommand in class Console
      Parameters:
      command - the string expression
      node - parsed expression
      res - result of evaluation
      Returns:
      true, false indicates the program should exit.
    • processEquation

      public Object processEquation(Node node) throws JepException
      Description copied from class: Console
      Performs the required operation on a node. Typically, evaluates the node and prints the value.
      Overrides:
      processEquation in class Console
      Parameters:
      node - Node representing expression
      Returns:
      The result of the calculation
      Throws:
      JepException - if a Parse or evaluation error
    • setMonitor

      public void setMonitor(String[] args)
      Description copied from class: Console
      Sets up monitoring of the call tree. Calls Console.setEvaluator(Evaluator) with a MonitoringEvaluator, sub-classes may need to override this method disable this feature.
      Overrides:
      setMonitor in class Console
      Parameters:
      args - second argument can be one of "off", "calls" or "times"
    • setEvaluator

      public void setEvaluator(Evaluator ev)
      Description copied from class: Console
      Sets the evaluator used. Default method simple calls Jep.setComponent(com.singularsys.jep.JepComponent) with the evaluator.
      Overrides:
      setEvaluator in class Console
      Parameters:
      ev - the evaluator to use
    • showCalls

      public void showCalls()
      Description copied from class: Console
      Shows a summary of function, operator, variable and constant calls.
      Overrides:
      showCalls in class Console
    • showTree

      public void showTree()
      Description copied from class: Console
      Shows the call tree with counts and times.
      Overrides:
      showTree in class Console
    • toString

      public String toString(Object o)
      Description copied from class: Console
      Return string representation of object. Used the doubleFormat if specified.
      Overrides:
      toString in class FieldConsole
      Parameters:
      o -
      Returns:
    • main

      public static void main(String[] args)
      Creates a new Console object and calls run()