Class ThreadSafeEvaluator
java.lang.Object
com.singularsys.jep.standard.FastEvaluator
com.singularsys.jep.misc.threadsafeeval.ThreadSafeEvaluator
- All Implemented Interfaces:
Evaluator
,JepComponent
,ParserVisitor
,Serializable
An evaluator which can safely evaluate an expression in multiple threads.
It works by finding the name of a variable from a Node and then using that name to find
the variable from the variable table. In essence, it adds one hash table lookup for each variable reference.
- Since:
- Jep 3.5
- Author:
- Richard Morris
- See Also:
-
Field Summary
Fields inherited from class com.singularsys.jep.standard.FastEvaluator
trapInfinity, trapNaN, trapNullValues, trapUnsetValues
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets a light-weight instance suitable for using in multiple threads.getVariable
(String name) void
Initialize the component.Methods inherited from class com.singularsys.jep.standard.FastEvaluator
eval, evaluate, isTrapInfinity, isTrapNaN, isTrapNullValues, isTrapUnsetValues, nodeAccept, setTrapInfinity, setTrapNaN, setTrapNullValues, setTrapUnsetValues, visit, visit, visit, visit, visitConstant, visitFun
-
Field Details
-
jep
-
vt
-
-
Constructor Details
-
ThreadSafeEvaluator
public ThreadSafeEvaluator()
-
-
Method Details
-
init
Description copied from interface:JepComponent
Initialize 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:
init
in interfaceJepComponent
- Overrides:
init
in classFastEvaluator
- Parameters:
jep1
- the current Jep instance
-
getLightWeightInstance
Description copied from interface:JepComponent
Gets a light-weight instance suitable for using in multiple threads.- Specified by:
getLightWeightInstance
in interfaceJepComponent
- Overrides:
getLightWeightInstance
in classFastEvaluator
- Returns:
- a new FastEvaluator
-
getVariable
-
visitVar
- Overrides:
visitVar
in classFastEvaluator
- Throws:
EvaluationException
-