|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.ocl.utilities.AbstractVisitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
public abstract class AbstractVisitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
An abstract implementation of the Visitor
API, in which subclasses
need only selectively override handleXxx(...)
methods for
internal AST nodes and visitXxx(...)
methods for leaf nodes.
The result
value is convenient for accumulating the result of the
visitation. In the subclass, simply assign/modify the result value as
necessary in the overridden visitation methods, and this framework will
ensure that it is returned as the overall value of the
Visitable.accept(Visitor)
call.
Field Summary | |
---|---|
protected T |
result
Accumulator for the result of the AST visitation. |
Constructor Summary | |
---|---|
protected |
AbstractVisitor()
Initializes me. |
protected |
AbstractVisitor(T initialValue)
Initializes me with an initial value for my result. |
Method Summary | |
---|---|
protected ExpressionInOCL<C,PM> |
getSpecification(CT constraint)
Overridden by subclasses interested in visiting constraints, to get the constraint's specification. |
protected T |
handleAssociationClassCallExp(AssociationClassCallExp<C,P> callExp,
T sourceResult,
java.util.List<T> qualifierResults)
Visits the specified association-class call with the results of visiting its source and qualifiers (if any). |
protected T |
handleCollectionItem(CollectionItem<C> item,
T itemResult)
Visits the specified collection item with the result of visiting its item expression. |
protected T |
handleCollectionLiteralExp(CollectionLiteralExp<C> literalExp,
java.util.List<T> partResults)
Visits the specified collection literal expression with the results of visiting its parts (if any). |
protected T |
handleCollectionRange(CollectionRange<C> range,
T firstResult,
T lastResult)
Visits the specified collection range with the results of visiting its first and last expressions. |
protected T |
handleConstraint(CT constraint,
T specificationResult)
Visits the specified constraint with the results of visiting its specification. |
protected T |
handleExpressionInOCL(ExpressionInOCL<C,PM> expression,
T contextResult,
T resultResult,
java.util.List<T> parameterResults,
T bodyResult)
Visits the specified expression-in-OCL with the results of visiting its context variable, its result variable (if any), its parameter variables (if any), and its body expression. |
protected T |
handleIfExp(IfExp<C> ifExp,
T conditionResult,
T thenResult,
T elseResult)
Visits the specified if expression with the results of visiting its condition, then, and else expressions. |
protected T |
handleIterateExp(IterateExp<C,PM> callExp,
T sourceResult,
java.util.List<T> variableResults,
T resultResult,
T bodyResult)
Visits the specified iterate expression with the results of visiting its source, its iterator variables, its result variable, and its body expression. |
protected T |
handleIteratorExp(IteratorExp<C,PM> callExp,
T sourceResult,
java.util.List<T> variableResults,
T bodyResult)
Visits the specified iterator expression with the results of visiting its source, its iterator variables, and its body expression. |
protected T |
handleLetExp(LetExp<C,PM> letExp,
T variableResult,
T inResult)
Visits the specified let expression with the results of visiting its variable and in expression. |
protected T |
handleMessageExp(MessageExp<C,COA,SSA> messageExp,
T targetResult,
java.util.List<T> argumentResults)
Visits the specified message expression with the results of visiting its target and arguments (if any). |
protected T |
handleOperationCallExp(OperationCallExp<C,O> callExp,
T sourceResult,
java.util.List<T> argumentResults)
Visits the specified operation call with the results of visiting its source and arguments (if any). |
protected T |
handlePropertyCallExp(PropertyCallExp<C,P> callExp,
T sourceResult,
java.util.List<T> qualifierResults)
Visits the specified property call with the results of visiting its source and qualifiers (if any). |
protected T |
handleTupleLiteralExp(TupleLiteralExp<C,P> literalExp,
java.util.List<T> partResults)
Visits the specified tuple literal expression with the results of visiting its parts (if any). |
protected T |
handleTupleLiteralPart(TupleLiteralPart<C,P> part,
T valueResult)
Visits the specified tuple literal part with the results of visiting its value (if any). |
protected T |
handleVariable(Variable<C,PM> variable,
T initResult)
Visits the specified variable with the results of visiting its initializer (if any). |
protected T |
safeVisit(Visitable v)
A null-safe visitation of the specified visitable. |
T |
visitAssociationClassCallExp(AssociationClassCallExp<C,P> callExp)
Visits the association-class-call source and then its qualifiers (if any). |
T |
visitBooleanLiteralExp(BooleanLiteralExp<C> literalExp)
Simply returns result . |
T |
visitCollectionItem(CollectionItem<C> item)
Visits the item's item expression. |
T |
visitCollectionLiteralExp(CollectionLiteralExp<C> literalExp)
Visits the collection literal's parts. |
T |
visitCollectionRange(CollectionRange<C> range)
Visits the range's first and last expressions. |
T |
visitConstraint(CT constraint)
Visits the constraint's specification, if any (and if the getSpecification(Object) method is overridden). |
T |
visitEnumLiteralExp(EnumLiteralExp<C,EL> literalExp)
Simply returns result . |
T |
visitExpressionInOCL(ExpressionInOCL<C,PM> expression)
Visits the expressions context variable, its parameter variables (if any), its result variable (if any), and finally its body expression. |
T |
visitIfExp(IfExp<C> ifExp)
Visits the if expression's condition, then, and else expressions. |
T |
visitIntegerLiteralExp(IntegerLiteralExp<C> literalExp)
Simply returns result . |
T |
visitInvalidLiteralExp(InvalidLiteralExp<C> literalExp)
Simply returns result . |
T |
visitIterateExp(IterateExp<C,PM> callExp)
Visits the iterate's source, then its iterator variables, result variable, and body expression. |
T |
visitIteratorExp(IteratorExp<C,PM> callExp)
Visits the iterator's source, then its variables, followed by its body expression. |
T |
visitLetExp(LetExp<C,PM> letExp)
Visits the let's variable declaration then its 'in' expression. |
T |
visitMessageExp(MessageExp<C,COA,SSA> messageExp)
Visits the message expression's target and then its arguments. |
T |
visitNullLiteralExp(NullLiteralExp<C> literalExp)
Simply returns result . |
T |
visitOperationCallExp(OperationCallExp<C,O> callExp)
Visits the operation-call source and then its arguments. |
T |
visitPropertyCallExp(PropertyCallExp<C,P> callExp)
Visits the property-call source and then its qualifiers (if any). |
T |
visitRealLiteralExp(RealLiteralExp<C> literalExp)
Simply returns result . |
T |
visitStateExp(StateExp<C,S> stateExp)
Simply returns result . |
T |
visitStringLiteralExp(StringLiteralExp<C> literalExp)
Simply returns result . |
T |
visitTupleLiteralExp(TupleLiteralExp<C,P> literalExp)
Visits the tuple literal's parts. |
T |
visitTupleLiteralPart(TupleLiteralPart<C,P> part)
Visits the tuple literal part's value, if any. |
T |
visitTypeExp(TypeExp<C> t)
Simply returns result . |
T |
visitUnlimitedNaturalLiteralExp(UnlimitedNaturalLiteralExp<C> literalExp)
Simply returns result . |
T |
visitUnspecifiedValueExp(UnspecifiedValueExp<C> unspecExp)
Simply returns result . |
T |
visitVariable(Variable<C,PM> variable)
Visits the variable's initialization expression (if any). |
T |
visitVariableExp(VariableExp<C,PM> v)
Simply returns result . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected T result
Constructor Detail |
---|
protected AbstractVisitor()
protected AbstractVisitor(T initialValue)
initialValue
- my initial result valueMethod Detail |
---|
protected T safeVisit(Visitable v)
v
- a visitable, or null
null
if the visitable is null
;
otherwise, the result of visiting itpublic T visitOperationCallExp(OperationCallExp<C,O> callExp)
handleOperationCallExp(OperationCallExp, Object, List)
.
visitOperationCallExp
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
protected T handleOperationCallExp(OperationCallExp<C,O> callExp, T sourceResult, java.util.List<T> argumentResults)
callExp
- the operation call expressionsourceResult
- the result of visiting the expression's sourceargumentResults
- the results of visiting the expression's
arguments, or an empty list if there are no arguments
result
, by defaultvisitOperationCallExp(OperationCallExp)
public T visitVariableExp(VariableExp<C,PM> v)
result
.
visitVariableExp
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
public T visitPropertyCallExp(PropertyCallExp<C,P> callExp)
handlePropertyCallExp(PropertyCallExp, Object, List)
.
visitPropertyCallExp
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
protected T handlePropertyCallExp(PropertyCallExp<C,P> callExp, T sourceResult, java.util.List<T> qualifierResults)
sourceResult will be null
in that case.
- Parameters:
callExp
- the property call expression, if there is a sourcesourceResult
- the result of visiting the expression's sourcequalifierResults
- the results of visiting the expression's
qualifiers, or an empty list if there are no qualifiers
- Returns:
- the accumulated
result
, by default - See Also:
visitPropertyCallExp(PropertyCallExp)
public T visitAssociationClassCallExp(AssociationClassCallExp<C,P> callExp)
handleAssociationClassCallExp(AssociationClassCallExp, Object, List)
.
visitAssociationClassCallExp
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
protected T handleAssociationClassCallExp(AssociationClassCallExp<C,P> callExp, T sourceResult, java.util.List<T> qualifierResults)
callExp
- the association-class call expressionsourceResult
- the result of visiting the expression's sourcequalifierResults
- the results of visiting the expression's
qualifiers, or an empty list if there are no qualifiers
result
, by defaultvisitAssociationClassCallExp(AssociationClassCallExp)
public T visitVariable(Variable<C,PM> variable)
handleVariable(Variable, Object)
.
visitVariable
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
protected T handleVariable(Variable<C,PM> variable, T initResult)
variable
- the variableinitResult
- the result of visiting the expression's initializer,
or null
if it has none
result
, by defaultvisitVariable(Variable)
public T visitIfExp(IfExp<C> ifExp)
handleIfExp(IfExp, Object, Object, Object)
.
visitIfExp
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
protected T handleIfExp(IfExp<C> ifExp, T conditionResult, T thenResult, T elseResult)
ifExp
- the if expressionconditionResult
- the result of visiting the expression's conditionthenResult
- the result of visiting the expression's thenelseResult
- the result of visiting the expression's else
result
, by defaultvisitIfExp(IfExp)
public T visitTypeExp(TypeExp<C> t)
result
.
visitTypeExp
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
public T visitMessageExp(MessageExp<C,COA,SSA> messageExp)
handleMessageExp(MessageExp, Object, List)
.
visitMessageExp
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
protected T handleMessageExp(MessageExp<C,COA,SSA> messageExp, T targetResult, java.util.List<T> argumentResults)
messageExp
- the message expressiontargetResult
- the result of visiting the expression's targetargumentResults
- the results of visiting the expression's
arguments, or an empty list if there are no arguments
result
, by defaultvisitMessageExp(MessageExp)
public T visitUnspecifiedValueExp(UnspecifiedValueExp<C> unspecExp)
result
.
visitUnspecifiedValueExp
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
public T visitStateExp(StateExp<C,S> stateExp)
result
.
visitStateExp
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
public T visitIntegerLiteralExp(IntegerLiteralExp<C> literalExp)
result
.
visitIntegerLiteralExp
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
public T visitUnlimitedNaturalLiteralExp(UnlimitedNaturalLiteralExp<C> literalExp)
result
.
visitUnlimitedNaturalLiteralExp
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
public T visitRealLiteralExp(RealLiteralExp<C> literalExp)
result
.
visitRealLiteralExp
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
public T visitStringLiteralExp(StringLiteralExp<C> literalExp)
result
.
visitStringLiteralExp
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
public T visitBooleanLiteralExp(BooleanLiteralExp<C> literalExp)
result
.
visitBooleanLiteralExp
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
public T visitNullLiteralExp(NullLiteralExp<C> literalExp)
result
.
visitNullLiteralExp
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
public T visitInvalidLiteralExp(InvalidLiteralExp<C> literalExp)
result
.
visitInvalidLiteralExp
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
public T visitTupleLiteralExp(TupleLiteralExp<C,P> literalExp)
handleTupleLiteralExp(TupleLiteralExp, List)
.
visitTupleLiteralExp
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
protected T handleTupleLiteralExp(TupleLiteralExp<C,P> literalExp, java.util.List<T> partResults)
literalExp
- the tuple literal expressionpartResults
- the results of visiting the expression's
parts, or an empty list if there are no parts
result
, by defaultvisitTupleLiteralExp(TupleLiteralExp)
public T visitTupleLiteralPart(TupleLiteralPart<C,P> part)
handleTupleLiteralPart(TupleLiteralPart, Object)
.
visitTupleLiteralPart
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
protected T handleTupleLiteralPart(TupleLiteralPart<C,P> part, T valueResult)
part
- the tuple literal partvalueResult
- the result of visiting the expression's value, or
null
if it has no value
result
, by defaultvisitTupleLiteralPart(TupleLiteralPart)
public T visitLetExp(LetExp<C,PM> letExp)
handleLetExp(LetExp, Object, Object)
.
visitLetExp
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
protected T handleLetExp(LetExp<C,PM> letExp, T variableResult, T inResult)
letExp
- the let expressionvariableResult
- the result of visiting the expression's variableinResult
- the result of visiting the expression's in expression
result
, by defaultvisitLetExp(LetExp)
public T visitEnumLiteralExp(EnumLiteralExp<C,EL> literalExp)
result
.
visitEnumLiteralExp
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
public T visitCollectionLiteralExp(CollectionLiteralExp<C> literalExp)
handleCollectionLiteralExp(CollectionLiteralExp, List)
.
visitCollectionLiteralExp
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
protected T handleCollectionLiteralExp(CollectionLiteralExp<C> literalExp, java.util.List<T> partResults)
literalExp
- the collection literal expressionpartResults
- the results of visiting the expression's
parts, or an empty list if there are no parts
result
, by defaultvisitCollectionLiteralExp(CollectionLiteralExp)
public T visitCollectionItem(CollectionItem<C> item)
handleCollectionItem(CollectionItem, Object)
visitCollectionItem
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
protected T handleCollectionItem(CollectionItem<C> item, T itemResult)
item
- the collection itemitemResult
- the result of visiting the item's item expression
result
, by defaultvisitCollectionItem(CollectionItem)
public T visitCollectionRange(CollectionRange<C> range)
handleCollectionRange(CollectionRange, Object, Object)
.
visitCollectionRange
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
protected T handleCollectionRange(CollectionRange<C> range, T firstResult, T lastResult)
range
- the collection rangefirstResult
- the result of visiting the range's first expressionlastResult
- the result of visiting the range's last expression
result
, by defaultvisitCollectionRange(CollectionRange)
public T visitIteratorExp(IteratorExp<C,PM> callExp)
handleIteratorExp(IteratorExp, Object, List, Object)
.
visitIteratorExp
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
protected T handleIteratorExp(IteratorExp<C,PM> callExp, T sourceResult, java.util.List<T> variableResults, T bodyResult)
callExp
- the iterator expressionsourceResult
- the result of visiting the expression's sourcevariableResults
- the results of visiting the expression's
iterator variablesbodyResult
- the result of visiting the expression's body
result
, by defaultvisitIteratorExp(IteratorExp)
public T visitIterateExp(IterateExp<C,PM> callExp)
handleIterateExp(IterateExp, Object, List, Object, Object)
.
visitIterateExp
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
protected T handleIterateExp(IterateExp<C,PM> callExp, T sourceResult, java.util.List<T> variableResults, T resultResult, T bodyResult)
callExp
- the iterate expressionsourceResult
- the result of visiting the expression's sourcevariableResults
- the results of visiting the expression's
iterator variablesresultResult
- the result of visiting the expressions' result variablebodyResult
- the result of visiting the expression's body
result
, by defaultvisitIterateExp(IterateExp)
public T visitExpressionInOCL(ExpressionInOCL<C,PM> expression)
handleExpressionInOCL(ExpressionInOCL, Object, Object, List, Object)
.
visitExpressionInOCL
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
protected T handleExpressionInOCL(ExpressionInOCL<C,PM> expression, T contextResult, T resultResult, java.util.List<T> parameterResults, T bodyResult)
expression
- the expression-in-OCLcontextResult
- the result of visiting the expression's context variableresultResult
- the result of visiting the expressions' result variable,
or null
if there is no result variableparameterResults
- the results of visiting the expression's
parameter variables, or an empty list if there are nonebodyResult
- the result of visiting the expression's body
result
, by defaultvisitExpressionInOCL(ExpressionInOCL)
public T visitConstraint(CT constraint)
getSpecification(Object)
method is overridden).
Returns the result of handleConstraint(Object, Object)
.
visitConstraint
in interface Visitor<T,C,O,P,EL,PM,S,COA,SSA,CT>
getSpecification(Object)
protected T handleConstraint(CT constraint, T specificationResult)
constraint
- the constraintspecificationResult
- the result of visiting the constraint's
specification, or null
if either it has none or the
getSpecification(Object)
method is not overridden
result
, by default
#see getSpecification(Object)
visitConstraint(Object)
protected ExpressionInOCL<C,PM> getSpecification(CT constraint)
constraint
- a constraint
visitConstraint(Object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |