Package com.singularsys.jep.standard
Class UncheckedEvaluator
- java.lang.Object
-
- com.singularsys.jep.standard.UncheckedEvaluator
-
- All Implemented Interfaces:
Evaluator
,JepComponent
,ParserVisitor
,java.io.Serializable
public final class UncheckedEvaluator extends java.lang.Object implements Evaluator, ParserVisitor
An evaluator which does fewer checks on values with a 5% faster speed.- Since:
- 3.5
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description UncheckedEvaluator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
eval(Node node)
Evaluates a sub expression.java.lang.Object
evaluate(Node node)
Main entry point, evaluates a node and returns and object with the value of the node.JepComponent
getLightWeightInstance()
Gets a light-weight instance suitable for using in multiple threads.void
init(Jep jep)
Initialize the component.protected java.lang.Object
nodeAccept(Node node)
java.lang.Object
visit(ASTConstant node, java.lang.Object data)
java.lang.Object
visit(ASTFunNode node, java.lang.Object data)
java.lang.Object
visit(ASTOpNode node, java.lang.Object data)
java.lang.Object
visit(ASTVarNode node, java.lang.Object data)
java.lang.Object
visitConstant(Node node)
protected java.lang.Object
visitFun(Node node)
Visits a function/operator node.java.lang.Object
visitVar(Node node)
-
-
-
Method Detail
-
init
public void init(Jep jep)
Description copied from interface:JepComponent
Initialize the component. This methods 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:
init
in interfaceJepComponent
- Parameters:
jep
- the current Jep instance
-
eval
public java.lang.Object eval(Node node) throws EvaluationException
Description copied from interface:Evaluator
Evaluates a sub expression. This method can be called by PostfixMathCommands which implementCallbackEvaluationI
- Specified by:
eval
in interfaceEvaluator
- Parameters:
node
- node to evaluate- Returns:
- The value after evaluating the sub expression.
- Throws:
EvaluationException
- if errors occur during evaluation;
-
evaluate
public java.lang.Object evaluate(Node node) throws EvaluationException
Description copied from interface:Evaluator
Main entry point, evaluates a node and returns and object with the value of the node.- Specified by:
evaluate
in interfaceEvaluator
- Parameters:
node
- node to evaluate- Returns:
- value after evaluation
- Throws:
EvaluationException
- if errors occur during evaluation;
-
nodeAccept
protected java.lang.Object nodeAccept(Node node) throws EvaluationException
- Throws:
EvaluationException
-
visit
public java.lang.Object visit(ASTConstant node, java.lang.Object data) throws EvaluationException
- Specified by:
visit
in interfaceParserVisitor
- Throws:
EvaluationException
-
visitConstant
public java.lang.Object visitConstant(Node node) throws EvaluationException
- Throws:
EvaluationException
-
visit
public java.lang.Object visit(ASTVarNode node, java.lang.Object data) throws EvaluationException
- Specified by:
visit
in interfaceParserVisitor
- Throws:
EvaluationException
-
visitVar
public java.lang.Object visitVar(Node node) throws EvaluationException
- Throws:
EvaluationException
-
visit
public java.lang.Object visit(ASTFunNode node, java.lang.Object data) throws EvaluationException
- Specified by:
visit
in interfaceParserVisitor
- Throws:
EvaluationException
-
visit
public java.lang.Object visit(ASTOpNode node, java.lang.Object data) throws EvaluationException
- Specified by:
visit
in interfaceParserVisitor
- Throws:
EvaluationException
-
visitFun
protected java.lang.Object visitFun(Node node) throws EvaluationException
Visits a function/operator node. This is the most visited method for most expression evaluations. Keeping it fast is important.- Parameters:
node
-- Throws:
EvaluationException
-
getLightWeightInstance
public JepComponent getLightWeightInstance()
Description copied from interface:JepComponent
Gets a light-weight instance suitable for using in multiple threads.- Specified by:
getLightWeightInstance
in interfaceJepComponent
- Returns:
- an new FastEvaluator
-
-