public class ParsedEquation extends java.lang.Object implements Expression, Equation
Constructor and Description |
---|
ParsedEquation() |
Modifier and Type | Method and Description |
---|---|
void |
addVariable(Variable var) |
Constant |
createBooleanConstant(boolean value) |
Constant |
createConstant(java.lang.String expr) |
void |
endParsing() |
java.lang.Object |
eval()
Evaluate the expression.
|
Expression |
getExpression()
Return the associated expression.
|
java.lang.String |
getExpressionName()
Return the expression name.
|
Expression |
getRoot()
Return the root expression.
|
Variable |
getVariable(java.lang.String varName)
Return a variable declared by the expression.
|
java.util.Map<java.lang.String,Variable> |
getVariables()
Return the variables used by this expression.
|
void |
setExpression(Expression expr) |
void |
setVariables(java.util.List<Variable> varsList) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getVariable, getVariables, hasVariable, hasVariable
public java.lang.String getExpressionName()
Expression
getExpressionName
in interface Expression
public void endParsing()
public void setExpression(Expression expr)
public java.util.Map<java.lang.String,Variable> getVariables()
int c=a+b
, only "a" and "b" will be returned.getVariables
in interface Expression
public Expression getExpression()
Expression
getExpression
in interface Equation
getExpression
in interface Expression
public Expression getRoot()
getRoot
in interface Expression
public void addVariable(Variable var)
public void setVariables(java.util.List<Variable> varsList)
public Variable getVariable(java.lang.String varName)
Expression
getVariable
in interface Expression
varName
- the variable namepublic Constant createBooleanConstant(boolean value)
public Constant createConstant(java.lang.String expr)
public java.lang.Object eval() throws java.lang.ArithmeticException
Expression
eval
in interface Expression
java.lang.ArithmeticException
Copyright © 2019-2024 Herve Girod. All Rights Reserved. Documentation and source under the BSD licence