Package com.singularsys.jep.misc.threadsafeeval

# Class ThreadSafeEvaluator

java.lang.Object
com.singularsys.jep.standard.FastEvaluator
com.singularsys.jep.misc.threadsafeeval.ThreadSafeEvaluator

All Implemented Interfaces:
  `Evaluator`, `GenericVisitor<Object,Void,EvaluationException>`, `JepComponent`, `Serializable`

public class ThreadSafeEvaluator extends FastEvaluator
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:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected Jep`
  `jep`
  `protected VariableTable`
  `vt`

  ### Fields inherited from class com.singularsys.jep.standard.FastEvaluator

  `trapInfinity, trapNaN, trapNullValues, trapUnsetValues`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ThreadSafeEvaluator()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `JepComponent`
  `getLightWeightInstance()`
  Gets a light-weight instance suitable for using in multiple threads.
  `Variable`
  `getVariable(String name)`
  `void`
  `init(Jep jep1)`
  Initialize the component.
  `Object`
  `visitVar(Node node)`

  ### Methods inherited from class com.singularsys.jep.standard.FastEvaluator

  `eval, evaluate, isTrapInfinity, isTrapNaN, isTrapNullValues, isTrapUnsetValues, makeException, nodeAccept, setTrapInfinity, setTrapNaN, setTrapNullValues, setTrapUnsetValues, visit, visit, visit, visit, visitConstant, visitFun`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface com.singularsys.jep.Evaluator

  `eval`

  ### Methods inherited from interface com.singularsys.jep.GenericVisitor

  `makeException, visit, visitChildren`

- ## Field Details

  - ### jep

    protected Jep jep

  - ### vt

    protected VariableTable vt

- ## Constructor Details

  - ### ThreadSafeEvaluator

    public ThreadSafeEvaluator()

- ## Method Details

  - ### init

    public void init(Jep jep1)
    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 interface `JepComponent`
    Overrides:
      `init` in class `FastEvaluator`
    Parameters:
      `jep1` - the current Jep instance

  - ### getLightWeightInstance

    public JepComponent getLightWeightInstance()
    Description copied from interface: `JepComponent`
    Gets a light-weight instance suitable for using in multiple threads.
    Specified by:
      `getLightWeightInstance` in interface `JepComponent`
    Overrides:
      `getLightWeightInstance` in class `FastEvaluator`
    Returns:
      a new FastEvaluator

  - ### getVariable

    public Variable getVariable(String name)

  - ### visitVar

    public Object visitVar(Node node) throws EvaluationException
    Overrides:
      `visitVar` in class `FastEvaluator`
    Throws:
      `EvaluationException`