public class EvalUtilities extends MathMLUtilities
fEvalEngine, fMathMLFactory
Constructor and Description |
---|
EvalUtilities()
Constructor for an object which evaluates an expression.
|
EvalUtilities(boolean mathMTagPrefix,
boolean relaxedSyntax)
Constructor for an object which evaluates an expression.
|
EvalUtilities(EvalEngine evalEngine,
boolean mathMTagPrefix,
boolean relaxedSyntax)
Constructor for an object which evaluates an expression.
|
Modifier and Type | Method and Description |
---|---|
static IExpr |
eval(java.lang.String inputExpression,
EvalEngine evalEngine)
Evaluate the
inputExpression and return the resulting
expression. |
IAST |
evalTrace(IExpr parsedExpression,
java.util.function.Predicate<IExpr> matcher,
IAST list)
Evaluate the
parsedExpression and return the
Trace[parsedExpression] (i.e. all (sub-)expressions needed
to calculate the result). |
IAST |
evalTrace(java.lang.String inputExpression,
java.util.function.Predicate<IExpr> matcher,
IAST list)
Evaluate the
inputExpression and return the
Trace[inputExpression] (i.e. all (sub-)expressions needed to
calculate the result). |
IExpr |
evaluate(IExpr parsedExpression)
Evaluate the
parsedExpression and return the resulting
expression. |
IExpr |
evaluate(java.lang.String inputExpression)
Evaluate the
inputExpression and return the resulting
expression. |
java.lang.String |
toJavaForm(java.lang.String inputExpression)
Converts the inputExpression string into a MathML expression and writes
the result to the given
Writer |
void |
toMathML(java.lang.String inputExpression,
java.io.Writer out)
Converts the inputExpression string into a MathML expression and writes
the result to the given
Writer |
getEvalEngine, startRequest, stopRequest, toJava, toMathML
public EvalUtilities()
EvalEngine
didn't create a history list for the
Out[]
function.evalEngine
- mathMTagPrefix
- if set to true
use "m:" as tag prefix
for the MathML output.relaxedSyntax
- public EvalUtilities(boolean mathMTagPrefix, boolean relaxedSyntax)
mathMTagPrefix
- if set to true
use "m:" as tag prefix
for the MathML output.relaxedSyntax
- if set to true
use "(...)" instead of
"[...]" for function arguments (i.e. sin(...)
instead of sin[...]).public EvalUtilities(EvalEngine evalEngine, boolean mathMTagPrefix, boolean relaxedSyntax)
evalEngine
- mathMTagPrefix
- if set to true
use "m:" as tag prefix
for the MathML output.relaxedSyntax
- if set to true
use "(...)" instead of
"[...]" for function arguments (i.e. sin(...)
instead of sin[...]).public IExpr evaluate(java.lang.String inputExpression) throws MathException
inputExpression
and return the resulting
expression.inputExpression
- the expression which should be evaluated.F.NIL
, if the inputExpression is null
MathException
public static IExpr eval(java.lang.String inputExpression, EvalEngine evalEngine) throws MathException
inputExpression
and return the resulting
expression. evalEngine
) to parse the expression in the "relaxed
mode" (i.e. "common math expression syntax" with
parentheses for function arguments) and if that results in a
SyntaxError
exception it tries to parse in the
"stronger mode" (i.e. with square brackets for function
arguments). SyntaxError
exception.inputExpression
- the expression which should be evaluated.evalEngine
- the evaluation engine which should be usedF.NIL
, if the inputExpression is null
MathException
public IExpr evaluate(IExpr parsedExpression) throws MathException
parsedExpression
and return the resulting
expression.parsedExpression
- the expression which should be evaluated.MathException
public java.lang.String toJavaForm(java.lang.String inputExpression) throws MathException
Writer
inputExpression
- out
- MathException
public IAST evalTrace(java.lang.String inputExpression, java.util.function.Predicate<IExpr> matcher, IAST list) throws MathException
inputExpression
and return the
Trace[inputExpression]
(i.e. all (sub-)expressions needed to
calculate the result).inputExpression
- the expression which should be evaluated.matcher
- a filter which determines the expressions which should be
traced, If the matcher is set to null
, all
expressions are traced.list
- an IAST object which will be cloned for containing the traced
expressions. Typically a F.List()
will be used.F.NIL
if inputExpression == null
MathException
public IAST evalTrace(IExpr parsedExpression, java.util.function.Predicate<IExpr> matcher, IAST list) throws java.lang.RuntimeException
parsedExpression
and return the
Trace[parsedExpression]
(i.e. all (sub-)expressions needed
to calculate the result).parsedExpression
- the expression which should be evaluated.matcher
- a filter which determines the expressions which should be
traced, If the matcher is set to null
, all
expressions are traced.list
- an IAST object which will be cloned for containing the traced
expressions. Typically a F.List()
will be used.java.lang.RuntimeException
public void toMathML(java.lang.String inputExpression, java.io.Writer out)
Writer
toMathML
in class MathMLUtilities