Package com.singularsys.jep

# Interface Evaluator

All Superinterfaces:
  `JepComponent`, `Serializable`

All Known Implementing Classes:
  `FastEvaluator`, `FastEvaluator3_4`, `FastEvaluator3_5`, `MonitoringEvaluator`, `PostfixEvaluator`, `RealEvaluator`, `StackCheckingFastEvaluator`, `StandardEvaluator`, `ThreadSafeEvaluator`, `UncheckedEvaluator`

public interface Evaluator extends JepComponent
Defines a method which can be used to evaluate a part of a node-tree. It is passed to classes that use CallbackEvaluatorI which need greater control over how they are evaluated.

Author:
  Rich Morris Created on 22-Apr-2005
See Also:
  - `CallbackEvaluationI`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default Object`
  `eval(NodeFactory nf, String name, PostfixMathCommandI pfmc, Node... children)`
  Evaluates a function with the given children.
  `Object`
  `eval(Node node)`
  Evaluates a sub expression.
  `Object`
  `evaluate(Node node)`
  Main entry point, evaluates a node and returns and object with the value of the node.

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

  `getLightWeightInstance, init`

- ## Method Details

  - ### evaluate

    Object evaluate(Node node) throws EvaluationException
    Main entry point, evaluates a node and returns and object with the value of the node.
    Parameters:
      `node` - node to evaluate
    Returns:
      value after evaluation
    Throws:
      `EvaluationException` - if errors occur during evaluation;

  - ### eval

    Object eval(Node node) throws EvaluationException
    Evaluates a sub expression. This method can be called by PostfixMathCommands which implement `CallbackEvaluationI`
    Parameters:
      `node` - node to evaluate
    Returns:
      The value after evaluating the sub expression.
    Throws:
      `EvaluationException` - if errors occur during evaluation;

  - ### eval

    default Object eval(NodeFactory nf, String name, PostfixMathCommandI pfmc, Node... children) throws EvaluationException
    Evaluates a function with the given children. If the function is one of `UnaryFunction`, `BinaryFunction`, `NaryFunction`, `NaryBinaryFunction`, or `NullaryFunction` then the appropriate eval method is called. Otherwise a temporary node is created with the given function and children and evaluated this this evaluator. This allows functions with special evaluations behaviour like `CallbackEvaluationI` to be evaluated correctly.
    Parameters:
      `nf` - NodeFactory to use to create a temporary node
      `name` - name of the function
      `pfmc` - the function to evaluate
      `children` - the children of the node to evaluate
    Returns:
      The value after evaluating the function.
    Throws:
      `EvaluationException` - if the pfmc is null or the number of children is not valid for the function.