Package com.singularsys.jep
Interface GenericVisitor<R,D,E extends Exception>
- Type Parameters:
R- return type, e.g. Node or BooleanD- context data passed to each node, e.g. aPredicate<Node>E- exception type thrown, typically aParseExceptionorEvaluationException
- 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 Summary
Modifier and TypeMethodDescriptiondefault EMethod called for invalid node type.makeException(String message) Create an Exception of the correct type.visit(ASTConstant node, D data) Visit a constant nodevisit(ASTFunNode node, D data) Visit a function nodeVisit an operator nodevisit(ASTVarNode node, D data) Visit a variable nodedefault RVisit a node calling the appropriate overloaded method.visitChildren(Node node, D data) Visit each child of a node
-
Method Details
-
visit
Visit a node calling the appropriate overloaded method.- Parameters:
node- current nodedata- context data passed to each child- Returns:
- result of visiting the node
- Throws:
E- on error
-
visitChildren
Visit each child of a node- Parameters:
node- parent nodedata- context data- Returns:
- a list with the result of visiting each node
- Throws:
E- on error
-
visit
Visit a constant node- Parameters:
node- current nodedata- context data- Returns:
- the result of visiting the node
- Throws:
E- on error
-
visit
Visit a function node- Parameters:
node- current nodedata- context data- Returns:
- the result of visiting the node
- Throws:
E- on error
-
visit
Visit a variable node- Parameters:
node- current nodedata- context data- Returns:
- the result of visiting the node
- Throws:
E- on error
-
visit
Visit an operator node- Parameters:
node- current nodedata- context data- Returns:
- the result of visiting the node
- Throws:
E- on error
-
makeException
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
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
-