Class Math_interpreter

java.lang.Object
   |
   +----Math_interpreter

public class Math_interpreter
extends Object
The Math_interpreter class constitutes the programming interface of the symbolic manipulation engine. The application: just create an instance of this class and call the method calculate and passing it as parameter the expression to be evaluated. As a result either a simplified (if possible) expression is return or in case of any input or processing errors an exception will be thrown.

Variable Index

 o INFIX_OUTPUT
 o STRUCTURED_OUTPUT
 o TEX_OUTPUT

Constructor Index

 o Math_interpreter()

Method Index

 o calculate(String)
 o getLastResult()
 o main(String[])
 o setOutputMode(int)

Variables

 o INFIX_OUTPUT
 public static final int INFIX_OUTPUT
Output is formatted in Infix notation
 o TEX_OUTPUT
 public static final int TEX_OUTPUT
Output is formatted for further processing with TeX/LateX
 o STRUCTURED_OUTPUT
 public static final int STRUCTURED_OUTPUT
Structured Output in ASCII format

Constructors

 o Math_interpreter
 public Math_interpreter() throws Exception
Initialises all components of the calculator. The output format is set to infix notation by default. If any error occurs during the initialisation, a general exception will be thrown.

Methods

 o setOutputMode
 public void setOutputMode(int mode)
Method to chose the output format of the result. Argument value must be one of the above defined constants to specify the format.
 o calculate
 public String calculate(String expression) throws Exception
Major method: It evaluates the argument string <expression> (for Syntax and notation see the project page) and returns the result as String. If any errors occurs (e.g. parse error) a general exception will be thrown which has to be caught by the application. The error text can than be analysed as usual.
 o getLastResult
 public String getLastResult()
The result of the last calculation is returned. If no calculation has taken place yet, the return value will be null.
 o main
 public static void main(String s[])
Alternitively the interpreter can be started as a stand alone application. In this case expressions can be passed as command line arguments. The results will be issued on the standard output in the respective order.