org.eclipse.ocl.examples.impactanalyzer
Interface ImpactAnalyzer

All Known Implementing Classes:
ImpactAnalyzerImpl

public interface ImpactAnalyzer

The Impact Analyzer (IA) analyzes the impact of Notifications on a single OCLExpression in the sense that it determines those context objects of the expression for which the expression's evaluation result may have changed because of the change indicated by the notification. Imagine this as "spreadsheet" functionality for models: model changes can be propagated efficiently, even for large to huge models. Possible application areas include OCL constraint re-evaluation after model changes as well as attribute grammars based on OCL.

The interaction with the IA typically happens in two steps. First call createFilterForExpression(). This returns an EventFilter which can be used to register a listener in the EventManager. The subscriber will then be supplied with all relevant Notifications relevant to the supplied OCLExpression.

Once a relevant Notification occurs it can be passed to the IA by calling getContextObjects(Notification) which returns a set of EObjects for which the expression's value may have changed due to the change notification. These context objects can be used to instruct the evaluator to evaluate affected OCLExpressions for a certain set of instances.

The impact analyzer has a few configuration options, affecting the choice of implementation. We currently use those to tune and performance-benchmark variants and flavors of the implementation. If you find that the default configuration doesn't work well for your case, you may try different configuration options. See OptimizationActivation and ActivationOption for details.

Author:
Axel Uhl

Method Summary
 EventFilter createFilterForExpression()
          Creates a filter for the given OCL expression, which matches at least all events that cause the expression to change its value on one or more context elements.
 java.util.Collection<org.eclipse.emf.ecore.EObject> getContextObjects(org.eclipse.emf.ecore.EObject evaluationResult)
          Determines a superset of the set of context objects for which the overall #expression managed by this instance scope analysis results in evaluationResult or a collection containing evaluationResult.
 java.util.Collection<org.eclipse.emf.ecore.EObject> getContextObjects(org.eclipse.emf.common.notify.Notification event)
          For a change notification event calculates a superset of the set of context objects for which expression may have changed its value due to the change indicated by the event.
 

Method Detail

createFilterForExpression

EventFilter createFilterForExpression()
Creates a filter for the given OCL expression, which matches at least all events that cause the expression to change its value on one or more context elements. Note that also events may be matched that don't actually lead to a change. The filter synthesis is "conservative" in this sense.

Returns:
the filter matching all relevant events

getContextObjects

java.util.Collection<org.eclipse.emf.ecore.EObject> getContextObjects(org.eclipse.emf.common.notify.Notification event)
For a change notification event calculates a superset of the set of context objects for which expression may have changed its value due to the change indicated by the event. As implied by "superset," the result set may contain context elements for which the expression's value may happen to not have changed.

Parameters:
event - the event to calculate for
Returns:
all relevant context objects; always a valid collection, never null

getContextObjects

java.util.Collection<org.eclipse.emf.ecore.EObject> getContextObjects(org.eclipse.emf.ecore.EObject evaluationResult)
Determines a superset of the set of context objects for which the overall #expression managed by this instance scope analysis results in evaluationResult or a collection containing evaluationResult. The result is always a valid collection, never null, but possibly empty.

Parameters:
evaluationResult - has to be a non-null EObject because backwards navigation is not easily possible for primitive-typed values and is impossible from null values for now.