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.
-
INFIX_OUTPUT
-
-
STRUCTURED_OUTPUT
-
-
TEX_OUTPUT
-
-
Math_interpreter()
-
-
calculate(String)
-
-
getLastResult()
-
-
main(String[])
-
-
setOutputMode(int)
-
INFIX_OUTPUT
public static final int INFIX_OUTPUT
- Output is formatted in Infix notation
TEX_OUTPUT
public static final int TEX_OUTPUT
- Output is formatted for further processing with TeX/LateX
STRUCTURED_OUTPUT
public static final int STRUCTURED_OUTPUT
- Structured Output in ASCII format
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.
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.
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.
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.
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.