Package com.singularsys.jep.standard
Class StandardEvaluator
java.lang.Object
com.singularsys.jep.standard.StandardEvaluator
- All Implemented Interfaces:
Evaluator,JepComponent,ParserVisitor,Serializable
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionEvaluates a sub expression.Main entry point, evaluates a node and returns and object with the value of the node.Gets a light-weight instance suitable for using in multiple threads.voidInitialize the component.booleanbooleanbooleanWhether null values for variables are trapped.voidsetTrapInfinity(boolean trapInfinity) voidsetTrapNaN(boolean trapNaN) voidsetTrapNullValues(boolean trapNullValues) Sets whether null values for variables are trapped.visit(ASTConstant node, Object data) visit(ASTFunNode node, Object data) visit(ASTVarNode node, Object data) visitConstant(Node node)
-
Constructor Details
-
StandardEvaluator
public StandardEvaluator()
-
-
Method Details
-
init
Description copied from interface:JepComponentInitialize the component. This method is called whenever a component is added to Jep. Hence, it allows components to keep track of the other components they may rely on.- Specified by:
initin interfaceJepComponent- Parameters:
jep- the current Jep instance
-
eval
Description copied from interface:EvaluatorEvaluates a sub expression. This method can be called by PostfixMathCommands which implementCallbackEvaluationI- Specified by:
evalin interfaceEvaluator- Parameters:
node- node to evaluate- Returns:
- The value after evaluating the sub expression.
- Throws:
EvaluationException- if errors occur during evaluation;
-
evaluate
Description copied from interface:EvaluatorMain entry point, evaluates a node and returns and object with the value of the node.- Specified by:
evaluatein interfaceEvaluator- Parameters:
node- node to evaluate- Returns:
- value after evaluation
- Throws:
EvaluationException- if errors occur during evaluation;
-
visit
- Specified by:
visitin interfaceParserVisitor- Throws:
EvaluationException
-
visitConstant
- Throws:
EvaluationException
-
visit
- Specified by:
visitin interfaceParserVisitor- Throws:
EvaluationException
-
visit
- Specified by:
visitin interfaceParserVisitor- Throws:
EvaluationException
-
visitVar
- Throws:
EvaluationException
-
visit
- Specified by:
visitin interfaceParserVisitor- Throws:
EvaluationException
-
isTrapNullValues
public boolean isTrapNullValues()Whether null values for variables are trapped.- Returns:
- the status if the trap null values flag.
-
setTrapNullValues
public void setTrapNullValues(boolean trapNullValues) Sets whether null values for variables are trapped. If set (the default) then an EvaluationException is thrown for null values of variables. If not set then null values are passed to PostfixMathCommands who will need to test for null values.- Parameters:
trapNullValues-
-
isTrapNaN
public boolean isTrapNaN() -
setTrapNaN
public void setTrapNaN(boolean trapNaN) -
isTrapInfinity
public boolean isTrapInfinity() -
setTrapInfinity
public void setTrapInfinity(boolean trapInfinity) -
getLightWeightInstance
Description copied from interface:JepComponentGets a light-weight instance suitable for using in multiple threads.- Specified by:
getLightWeightInstancein interfaceJepComponent- Returns:
- a new StandardEvaluator
-