"Visitors" are classes containing methods intended to perform certain actions upon different kinds of expressions (elements, statemets, references).
For example, a class implementing SciExpressionVisitor interface,
defines methods for visiting different kinds of expressions: visitFunctionCallExpression,
visitTypeCastExpression etc. When the accept method is invoked on an
expression,
then this method
automatically determines a kind of this expression (FUNCTION_CALL, TYPE_CAST etc)
and runs visitor's corresponding method to the kind of expression, passing expression as a parameter to that method.
This mechanism lets you define visitors perfoming similar actions for every kind of expressions
(elements, statements, references)
on their own manner - for example, a visitor printingExpressionVisitor can print
expression's kind-specific commentary. These kind-specific actions have to be written in corresponding
methods( visitFunctionCallExpression,
visitTypeCastExpression etc). Now, when an expression
invokes accept(printingExpressionVisitor) method,
this visitor will print the comment corresponding to the kind of this expression.
"Adapter" classes (SciExpressionVisitorAdapter, SciElementVisitorAdapter etc) are simple
implementations of corresponding "Visitor" interfaces.