com.singularsys.jeptests.system

## Class StackCheckingFastEvaluator

- java.lang.Object
- - com.singularsys.jeptests.system.StackCheckingFastEvaluator

- All Implemented Interfaces:
    Evaluator, JepComponent, ParserVisitor, java.io.Serializable

      public class StackCheckingFastEvaluator
      extends java.lang.Object
      implements Evaluator, ParserVisitor

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `trapInfinity`
    `protected boolean` | `trapNaN`
    `protected boolean` | `trapNullValues`
    `protected boolean` | `trapUnsetValues` Whether null values for variables are trapped

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StackCheckingFastEvaluator()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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.
    `boolean` | `isTrapInfinity()`
    `boolean` | `isTrapNaN()`
    `boolean` | `isTrapNullValues()` Whether null values for variables are trapped.
    `boolean` | `isTrapUnsetValues()` Whether variables with unset values are trapped.
    `protected java.lang.Object` | `nodeAccept(Node node)`
    `void` | `setTrapInfinity(boolean trapInfinity)`
    `void` | `setTrapNaN(boolean trapNaN)`
    `void` | `setTrapNullValues(boolean trapNullValues)` Sets whether null values for variables are trapped.
    `void` | `setTrapUnsetValues(boolean trapUnsetValues)` Sets whether unset variable values are trapped.
    `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)`

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

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

- - ### Field Detail

    - #### trapUnsetValues

          protected boolean trapUnsetValues

      Whether null values for variables are trapped

    - #### trapNullValues

          protected boolean trapNullValues

    - #### trapNaN

          protected boolean trapNaN

    - #### trapInfinity

          protected boolean trapInfinity

  - ### Constructor Detail

    - #### StackCheckingFastEvaluator

          public StackCheckingFastEvaluator()

  - ### 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 interface `JepComponent`
      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 implement `CallbackEvaluationI`
      Specified by:
        `eval` in interface `Evaluator`
      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 interface `Evaluator`
      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 interface `ParserVisitor`
      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 interface `ParserVisitor`
      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 interface `ParserVisitor`
      Throws:
        `EvaluationException`

    - #### visit

          public java.lang.Object visit(ASTOpNode node,
                                        java.lang.Object data)
                                 throws EvaluationException

      Specified by:
        `visit` in interface `ParserVisitor`
      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`

    - #### isTrapUnsetValues

          public boolean isTrapUnsetValues()

      Whether variables with unset values are trapped.
      Returns:
      Since:
        3.5

    - #### setTrapUnsetValues

          public void setTrapUnsetValues(boolean trapUnsetValues)

      Sets whether unset variable values are trapped. This flag is set by when the `Variable.setValidValue(boolean)` or cleared using `VariableTable.clearValues()`.
      Parameters:
        `trapUnsetValues` - true to trap unset values, false to ignore them
      Since:
        3.5

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

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

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