Interface GenericVisitor<R,D,E extends Exception>

Type Parameters:
R - return type, e.g. Node or Boolean
D - context data passed to each node, e.g. a Predicate<Node>
E - exception type thrown, typically a ParseException or EvaluationException
All Known Implementing Classes:
AbstractEval, CommandVisitor, DDimensionVisitor, DEquationExtractor, DExpressionCleaner, DifferentiationVisitor, DimensionVisitor, DPolynomialCreator, EquationExtractor, ExpressionCleaner, ExpressionConsolidator, FastEvaluator, GenericDeepCopyVisitor, GenericDoNothingVisitor, ImportationVisitor, LightWeightImportationVisitor, MatrixDifferentiationVisitor, MonitoringEvaluator, MrpEval, OverloadResolver, PolynomialCreator, RewriteVisitor, RpEval, StackCheckingFastEvaluator, SubstitutionVisitor, TestingVisitor, ThreadSafeEvaluator, XEvaluator, XMonitoringEvaluator

public interface GenericVisitor<R,D,E extends Exception>
A generic version of the ParserVisitor allowing the return type, data parsed and exception type to be specified.
Since:
Jep 4.1
  • Method Details

    • visit

      default R visit(Node node, D data) throws E
      Visit a node calling the appropriate overloaded method.
      Parameters:
      node - current node
      data - context data passed to each child
      Returns:
      result of visiting the node
      Throws:
      E - on error
    • visitChildren

      default List<R> visitChildren(Node node, D data) throws E
      Visit each child of a node
      Parameters:
      node - parent node
      data - context data
      Returns:
      a list with the result of visiting each node
      Throws:
      E - on error
    • visit

      R visit(ASTConstant node, D data) throws E
      Visit a constant node
      Parameters:
      node - current node
      data - context data
      Returns:
      the result of visiting the node
      Throws:
      E - on error
    • visit

      R visit(ASTFunNode node, D data) throws E
      Visit a function node
      Parameters:
      node - current node
      data - context data
      Returns:
      the result of visiting the node
      Throws:
      E - on error
    • visit

      R visit(ASTVarNode node, D data) throws E
      Visit a variable node
      Parameters:
      node - current node
      data - context data
      Returns:
      the result of visiting the node
      Throws:
      E - on error
    • visit

      R visit(ASTOpNode node, D data) throws E
      Visit an operator node
      Parameters:
      node - current node
      data - context data
      Returns:
      the result of visiting the node
      Throws:
      E - on error
    • makeException

      default E makeException(Node n)
      Method called for invalid node type. Should never be called but needed for generic type safety.

      The default implementation calls makeException(String) with a message defined by the IllegalNodeTypeEncountered property.

      Parameters:
      n - Node the visitor failed on
      Returns:
      an Exception of the appropriate type
    • makeException

      E makeException(String message)
      Create an Exception of the correct type. A typical implementation is
      @Override
      public JepException makeException(String message) {
       return new JepException(message);
      }
      
      Parameters:
      message - error message
      Returns:
      an Exception