Overview | Package | Class | Use | Tree | Index | Help
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

## Package com.togethersoft.openapi.sci.visitor

A set of classes and interfaces implementing Visitor pattern from GoF "Design Patterns" book.

See
Description

Class Diagram Summary
visitor |

Interface Summary
SciElementVisitor | Visitor design pattern implementation for `SciElement`s.
SciExpressionVisitor | Visitor design pattern implementation for `SciExpression`s.
SciFileVisitor |
SciPackageVisitor |
SciReferenceVisitor | Visitor design pattern implementation for `SciReference`s.
SciStatementVisitor | Visitor design pattern implementation for `SciStatement`s.

Class Summary
SciElementVisitorAdapter | `SciElementVisitorAdapter` class extends `SciElementVisitor` functionality by providing an additional method `visitElement`.
SciExpressionVisitorAdapter | An empty implementation of `SciExpressionVisitor` interface.
SciStatementVisitorAdapter | An empty implementation of `SciStatementVisitor` interface.
SciVisitorUtil | This class contains a set of useful static methods for accepting a visitor by an enumeration of elements, expressions, statements or references.

## Package com.togethersoft.openapi.sci.visitor Description

A set of classes and interfaces implementing Visitor pattern from GoF "Design Patterns" book.

"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.

Overview | Package | Class | Use | Tree | Index | Help
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES