public class ExprEvaluator
extends java.lang.Object
IExpr
results.Constructor and Description |
---|
ExprEvaluator()
Constructor for an
IExpr object evaluator. |
ExprEvaluator(boolean outListDisabled,
int historyCapacity)
Constructor for an
IExpr object evaluator. |
ExprEvaluator(EvalEngine engine,
boolean outListDisabled,
int historyCapacity)
Constructor for an
IExpr object evaluator. |
Modifier and Type | Method and Description |
---|---|
void |
clearVariables()
Clear all defined variables for this evaluator.
|
ISymbol |
defineVariable(ISymbol variable)
Define a given variable on the local variable stack without assigning a
value.
|
ISymbol |
defineVariable(ISymbol variable,
double value)
Define a double value for a given variable name.
|
ISymbol |
defineVariable(ISymbol variable,
IExpr value)
Define a value for a given variable name.
|
ISymbol |
defineVariable(java.lang.String variableName)
Define a given variable name on the local variable stack without
assigning a value.
|
void |
defineVariable(java.lang.String variableName,
boolean value)
Define a boolean value for a given variable name.
|
ISymbol |
defineVariable(java.lang.String variableName,
double value)
Define a double value for a given variable name.
|
ISymbol |
defineVariable(java.lang.String variableName,
IExpr value)
Define a value for a given variable name.
|
IExpr |
evaluate()
Reevaluate the last
expression (possibly after a new
variable assignment). |
IExpr |
evaluate(IExpr expr)
Evaluate an expression for the given "local variables list".
|
IExpr |
evaluate(java.lang.String inputExpression)
Parse the given
expression String and evaluate it to an
IExpr value |
double |
evaluateDoube(java.lang.String inputExpression)
Parse the given
expression String and evaluate it to a
double value |
EvalEngine |
getEvalEngine() |
IExpr |
getVariable(java.lang.String variableName)
Returns the expression value to which the specified variableName is
mapped, or
null if this map contains no mapping for the
variableName. |
java.lang.String |
toJavaForm(java.lang.String inputExpression)
Converts the inputExpression string into a Java Symja expression string.
|
java.lang.String |
toScalaForm(java.lang.String inputExpression)
Converts the inputExpression string into a Scala expression and writes
the result to the given
Writer string. |
public ExprEvaluator()
IExpr
object evaluator. By default no
output history for the Out()
function is stored in the
evaluation engine. $ans
won't get evaluate to the last
result.public ExprEvaluator(boolean outListDisabled, int historyCapacity)
IExpr
object evaluator. By default no
output history for the Out()
function is stored in the
evaluation engine. $ans
won't get evaluate to the last
result.outListDisabled
- if false
create a
LastCalculationsHistory(historyCapacity)
,
otherwise no history of the last calculations will be saved
and the Out()
function (or $ans
variable or the %
operator) will be unevaluated.historyCapacity
- the number of last entries of the calculations which should be
stored.public ExprEvaluator(EvalEngine engine, boolean outListDisabled, int historyCapacity)
IExpr
object evaluator. By default no
output history for the Out()
function is stored in the
evaluation engine. $ans
won't get evaluate to the last
result.outListDisabled
- if false
create a
LastCalculationsHistory(historyCapacity)
,
otherwise no history of the last calculations will be saved
and the Out()
function (or $ans
variable or the %
operator) will be unevaluated.historyCapacity
- the number of last entries of the calculations which should be
stored.public void clearVariables()
public ISymbol defineVariable(ISymbol variable)
variable
- value
- public ISymbol defineVariable(ISymbol variable, double value)
variable
- value
- public ISymbol defineVariable(ISymbol variable, IExpr value)
variable
- value
- public ISymbol defineVariable(java.lang.String variableName)
variableName
- value
- public void defineVariable(java.lang.String variableName, boolean value)
variableName
- value
- public ISymbol defineVariable(java.lang.String variableName, double value)
variableName
- value
- public ISymbol defineVariable(java.lang.String variableName, IExpr value)
variableName
- value
- public IExpr evaluate()
expression
(possibly after a new
variable assignment).SyntaxError
public IExpr evaluate(IExpr expr)
expr
- the expression which should be evaluatedpublic IExpr evaluate(java.lang.String inputExpression)
expression String
and evaluate it to an
IExpr valueexpression
- SyntaxError
public double evaluateDoube(java.lang.String inputExpression)
expression String
and evaluate it to a
double valueexpression
- SyntaxError
public EvalEngine getEvalEngine()
public IExpr getVariable(java.lang.String variableName)
null
if this map contains no mapping for the
variableName.variableName
- public java.lang.String toJavaForm(java.lang.String inputExpression) throws MathException
inputExpression
- out
- MathException
public java.lang.String toScalaForm(java.lang.String inputExpression) throws MathException
Writer
string.inputExpression
- out
- MathException