public class FilterSynthesisImpl extends AbstractVisitor<org.eclipse.emf.ecore.EPackage,org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EOperation,org.eclipse.emf.ecore.EStructuralFeature,org.eclipse.emf.ecore.EEnumLiteral,org.eclipse.emf.ecore.EParameter,org.eclipse.emf.ecore.EObject,CallOperationAction,SendSignalAction,Constraint> implements OperationBodyToCallMapper
OCLExpression recursively. The analyzer can be parameterized during
construction such that it either registers for creation events on the context type or not. Registering for element
creation on the context type is useful for invariants / constraints because when a new element is created, validating
the constraint may be useful. For other use cases, registering for element creation may not be so useful. For
example, when a type inferencer defines its rules using OCL, it only wants to receive update events after
the element has been fully initialized from those OCLExpression. In those cases, some framework may be responsible
for the initial evaluation of those OCLExpressions on new element, and therefore, context element creation events
are not of interest.| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<org.eclipse.emf.ecore.EReference,java.util.Set<NavigationCallExp>> |
associationEndCallExpressions |
protected java.util.Set<EventFilter> |
filters
For each
OCLExpression analyzed, stores the filters to merge into the resulting filter |
result| Constructor and Description |
|---|
FilterSynthesisImpl(OCLExpression expression,
boolean notifyNewContextElements,
OCL ocl) |
| Modifier and Type | Method and Description |
|---|---|
java.util.Set<OperationCallExp> |
getAllInstancesCallsFor(org.eclipse.emf.ecore.EClassifier c)
Always returns a non-null set.
|
java.util.Set<NavigationCallExp> |
getAssociationEndCallExpressions(org.eclipse.emf.ecore.EReference a)
Always returns a non-null set
|
java.util.Set<PropertyCallExp> |
getAttributeCallExpressions(org.eclipse.emf.ecore.EAttribute a)
Always returns a non-null set
|
OCLExpression |
getBodyForCall(OperationCallExp call)
Looks up if the
OCLExpression that is called by the given OperationCallExp has already been visited. |
java.util.Set<OperationCallExp> |
getCallsOf(OCLExpression operationBodyExpression)
Returns all the calls to the operation whose body is operationBodyExpression that are reachable from the root
expression analyzed by this
FilterSynthesis. |
java.util.Map<OCLExpression,java.util.Set<PropertyCallExp>> |
getDerivedProperties() |
OCLExpression |
getOperationBody(org.eclipse.emf.ecore.EOperation operation)
Determines the body expression of an operation
|
java.util.Set<Variable> |
getParameterVariablesUsedInBody(OCLExpression body)
Determines the
self variable as used by the operation body body. |
java.util.Set<Variable> |
getSelfVariablesUsedInBody(OCLExpression body)
Determines the
self variables as used by the operation body or top-level non-operation-body (e.g., invariant)
expression body. |
EventFilter |
getSynthesisedFilter()
Obtains the event filter for the expression passed to the constructor.
|
org.eclipse.emf.ecore.EPackage |
handleOperationCallExp(OperationCallExp<org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EOperation> opCallExp,
org.eclipse.emf.ecore.EPackage sourceResult,
java.util.List<org.eclipse.emf.ecore.EPackage> qualifierResults)
Visits the specified operation call with the results of visiting
its source and arguments (if any).
|
org.eclipse.emf.ecore.EPackage |
handleOppositePropertyCallExp(OppositePropertyCallExp callExp,
org.eclipse.emf.ecore.EPackage sourceResult) |
org.eclipse.emf.ecore.EPackage |
handlePropertyCallExp(PropertyCallExp<org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EStructuralFeature> propCallExp,
org.eclipse.emf.ecore.EPackage sourceResult,
java.util.List<org.eclipse.emf.ecore.EPackage> qualifierResults)
Visits the specified property call with the results of visiting
its source and qualifiers (if any).
|
org.eclipse.emf.ecore.EPackage |
visitOppositePropertyCallExp(OppositePropertyCallExp callExp)
Visits the property-call source and then its qualifiers (if any).
|
org.eclipse.emf.ecore.EPackage |
visitVariableExp(VariableExp<org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EParameter> var)
Simply returns
AbstractVisitor.result. |
getSpecification, handleAssociationClassCallExp, handleCollectionItem, handleCollectionLiteralExp, handleCollectionRange, handleConstraint, handleExpressionInOCL, handleIfExp, handleIterateExp, handleIteratorExp, handleLetExp, handleMessageExp, handleTupleLiteralExp, handleTupleLiteralPart, handleVariable, safeVisit, visitAssociationClassCallExp, visitBooleanLiteralExp, visitCollectionItem, visitCollectionLiteralExp, visitCollectionRange, visitConstraint, visitEnumLiteralExp, visitExpressionInOCL, visitIfExp, visitIntegerLiteralExp, visitInvalidLiteralExp, visitIterateExp, visitIteratorExp, visitLetExp, visitMessageExp, visitNullLiteralExp, visitOperationCallExp, visitPropertyCallExp, visitRealLiteralExp, visitStateExp, visitStringLiteralExp, visitTupleLiteralExp, visitTupleLiteralPart, visitTypeExp, visitUnlimitedNaturalLiteralExp, visitUnspecifiedValueExp, visitVariableprotected final java.util.Set<EventFilter> filters
OCLExpression analyzed, stores the filters to merge into the resulting filterprotected final java.util.Map<org.eclipse.emf.ecore.EReference,java.util.Set<NavigationCallExp>> associationEndCallExpressions
public FilterSynthesisImpl(OCLExpression expression, boolean notifyNewContextElements, OCL ocl)
expression - The OCLExpression the filter should be created for.notifyNewContextElements - The analyzer can be parameterized during construction such that it either registers for creation
events on the context type or not. Registering for element creation on the context type is useful for
invariants / constraints because when a new element is created, validating the constraint may be
useful. For other use cases, registering for element creation may not be so useful. For example, when
a type inferencer defines its rules using OCL, it only wants to receive update events after
the element has been fully initialized from those OCL expressions. In those cases, some framework may
be responsible for the initial evaluation of those OCL expressions on new element, and therefore,
context element creation events are not of interest.public org.eclipse.emf.ecore.EPackage handlePropertyCallExp(PropertyCallExp<org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EStructuralFeature> propCallExp, org.eclipse.emf.ecore.EPackage sourceResult, java.util.List<org.eclipse.emf.ecore.EPackage> qualifierResults)
AbstractVisitorsourceResult will be null in that case.handlePropertyCallExp in class AbstractVisitor<org.eclipse.emf.ecore.EPackage,org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EOperation,org.eclipse.emf.ecore.EStructuralFeature,org.eclipse.emf.ecore.EEnumLiteral,org.eclipse.emf.ecore.EParameter,org.eclipse.emf.ecore.EObject,CallOperationAction,SendSignalAction,Constraint>propCallExp - 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 qualifiersAbstractVisitor.result, by defaultAbstractVisitor.visitPropertyCallExp(PropertyCallExp)public org.eclipse.emf.ecore.EPackage handleOperationCallExp(OperationCallExp<org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EOperation> opCallExp, org.eclipse.emf.ecore.EPackage sourceResult, java.util.List<org.eclipse.emf.ecore.EPackage> qualifierResults)
AbstractVisitorhandleOperationCallExp in class AbstractVisitor<org.eclipse.emf.ecore.EPackage,org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EOperation,org.eclipse.emf.ecore.EStructuralFeature,org.eclipse.emf.ecore.EEnumLiteral,org.eclipse.emf.ecore.EParameter,org.eclipse.emf.ecore.EObject,CallOperationAction,SendSignalAction,Constraint>opCallExp - the operation call expressionsourceResult - the result of visiting the expression's sourcequalifierResults - the results of visiting the expression's
arguments, or an empty list if there are no argumentsAbstractVisitor.result, by defaultAbstractVisitor.visitOperationCallExp(OperationCallExp)public org.eclipse.emf.ecore.EPackage visitVariableExp(VariableExp<org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EParameter> var)
AbstractVisitorAbstractVisitor.result.visitVariableExp in interface Visitor<org.eclipse.emf.ecore.EPackage,org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EOperation,org.eclipse.emf.ecore.EStructuralFeature,org.eclipse.emf.ecore.EEnumLiteral,org.eclipse.emf.ecore.EParameter,org.eclipse.emf.ecore.EObject,CallOperationAction,SendSignalAction,Constraint>visitVariableExp in class AbstractVisitor<org.eclipse.emf.ecore.EPackage,org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EOperation,org.eclipse.emf.ecore.EStructuralFeature,org.eclipse.emf.ecore.EEnumLiteral,org.eclipse.emf.ecore.EParameter,org.eclipse.emf.ecore.EObject,CallOperationAction,SendSignalAction,Constraint>public java.util.Set<OperationCallExp> getCallsOf(OCLExpression operationBodyExpression)
FilterSynthesis. If no such calls exist, an empty set is returned.getCallsOf in interface OperationBodyToCallMapperpublic EventFilter getSynthesisedFilter()
ImpactAnalyzer.getContextObjects(Notification).public OCLExpression getBodyForCall(OperationCallExp call)
OCLExpression that is called by the given OperationCallExp has already been visited.call - The OperationCallExp to look forOCLExpression that defines the body of the called operationpublic java.util.Set<PropertyCallExp> getAttributeCallExpressions(org.eclipse.emf.ecore.EAttribute a)
public java.util.Set<NavigationCallExp> getAssociationEndCallExpressions(org.eclipse.emf.ecore.EReference a)
public java.util.Set<OperationCallExp> getAllInstancesCallsFor(org.eclipse.emf.ecore.EClassifier c)
public java.util.Set<Variable> getSelfVariablesUsedInBody(OCLExpression body)
OperationBodyToCallMapperself variables as used by the operation body or top-level non-operation-body (e.g., invariant)
expression body. While it might seem a little strange to have multiple self variables within the
same operation body, that's however what may happen in Ecore OCL. It would otherwise be tricky to identify the
self variable when given the body or the EOperation element. If self is not used by the
body, then null will be returned. Never returns null but may return an empty set.getSelfVariablesUsedInBody in interface OperationBodyToCallMapperpublic java.util.Set<Variable> getParameterVariablesUsedInBody(OCLExpression body)
OperationBodyToCallMapperself variable as used by the operation body body. It would otherwise
be tricky to identify the self variable when given the body or the EOperation element. If
self is not used by the body, then null will be returned. Never returns null
but may return an empty set.getParameterVariablesUsedInBody in interface OperationBodyToCallMapperpublic OCLExpression getOperationBody(org.eclipse.emf.ecore.EOperation operation)
OperationBodyToCallMappergetOperationBody in interface OperationBodyToCallMapperpublic org.eclipse.emf.ecore.EPackage handleOppositePropertyCallExp(OppositePropertyCallExp callExp, org.eclipse.emf.ecore.EPackage sourceResult)
public org.eclipse.emf.ecore.EPackage visitOppositePropertyCallExp(OppositePropertyCallExp callExp)
AbstractVisitor.handlePropertyCallExp(PropertyCallExp, Object, List).public java.util.Map<OCLExpression,java.util.Set<PropertyCallExp>> getDerivedProperties()