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, JepComponent, ParserVisitor, java.io.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 and Description
    --- | ---
    `protected Jep` | `jep`
    `protected VariableTable` | `vt`

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

      `trapInfinity, trapNaN, trapNullValues, trapUnsetValues`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ThreadSafeEvaluator()`

  - ### Method Summary

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

    - ### 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`

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

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

- - ### Field Detail

    - #### jep

          protected Jep jep

    - #### vt

          protected VariableTable vt

  - ### Constructor Detail

    - #### ThreadSafeEvaluator

          public ThreadSafeEvaluator()

  - ### Method Detail

    - #### init

          public void init(Jep jep1)

      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 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:
        an new FastEvaluator

    - #### getVariable

          public Variable getVariable(java.lang.String name)

    - #### visitVar

          public java.lang.Object visitVar(Node node)
                                    throws EvaluationException

      Overrides:
        `visitVar` in class `FastEvaluator`
      Throws:
        `EvaluationException`

Copyright © 2018 Singular Systems http://www.singularsys.com/jep