Home » Modeling » OCL » Create Influence Diagram from OCL Statement
| | | | | |
Re: Create Influence Diagram from OCL Statement [message #691474 is a reply to message #691451] |
Fri, 01 July 2011 14:20 |
ModelGeek Mising name Messages: 550 Registered: June 2011 |
Senior Member |
|
|
Hi,
I have one confusion from the documentation page, below is the chunk of code from documentation page.
final OCLExpression e = ...;
final ImpactAnalyzer impactAnalyzer = ImpactAnalyzerFactory.INSTANCE.createImpactAnalyzer(
e, // the expression to re-evaluate incrementally
false, // whether to re-evaluate when new context objects appear
OCLFactory.INSTANCE);
here OCLExpression is org.eclipse.ocl.ecore.OCLExpression and normally it is used for AbtractVisitor class
and org.eclipse.ocl.expressions.OCLExpression is another class which is used to parse OCL statements like
OCL<?, EClassifier, EOperation, ?, ?, ?, ?, ?, ?, Constraint, EClass, EObject> ocl;
ocl = OCL.newInstance(EcoreEnvironmentFactory.INSTANCE);
OCLHelper<EClassifier, EOperation, ?, Constraint> helper = ocl.createOCLHelper();
helper.setContext(eClass);
OCLExpression<EClassifier> query = helper.createQuery(attribute.getpOCLStatement());
Why impact analyzer is using org.eclipse.ocl.ecore.OCLExpression and do this mean i have to extend AbstractVisitor or some other to get object of org.eclipse.ocl.ecore.OCLExpression ?
how can i get org.eclipse.ocl.ecore.OCLExpression object?
please help
Warmest Regards
|
|
|
Re: Create Influence Diagram from OCL Statement [message #691490 is a reply to message #691474] |
Fri, 01 July 2011 15:00 |
Ed Willink Messages: 7670 Registered: July 2009 |
Senior Member |
|
|
Hi
Yes. These templates are very confusing, which is why a prototype new
approach with no templates is available in the examples plugins
awaiting promotion in the Juno release.
org.eclipse.ocl.ecore.OCLExpression extends
org.eclipse.ocl.OCLExpression<EClassifier>
and
org.eclipse.ocl.uml.OCLExpression extends
org.eclipse.ocl.OCLExpression<Classifier>
so the templated classes give shared Ecore/UML functionality. Only one
of the two can be imported, the
other must be explicitly qualified.
I recommend always importing the untemplated versions and qualifying the
templated ones. Most of the
time you can use the untemplated classes, and I suspect that half of
your quoted example can be simplified in this way.
Unfortunately return values from shared functionality do not return
untemplated classes; you can safely cast them.
Regards
Ed Willink
On 01/07/2011 16:20, forums-noreply@eclipse.org wrote:
> Hi,
>
> I have one confusion from the documentation page, below is the chunk
> of code from documentation page.
> final OCLExpression e = ...;
> final ImpactAnalyzer impactAnalyzer =
> ImpactAnalyzerFactory.INSTANCE.createImpactAnalyzer(
> e, // the expression to re-evaluate incrementally
> false, // whether to re-evaluate when new context objects appear
> OCLFactory.INSTANCE);
>
> here OCLExpression is org.eclipse.ocl.ecore.OCLExpression and normally
> it is used for AbtractVisitor class
>
> and org.eclipse.ocl.expressions.OCLExpression is another class which
> is used to parse OCL statements like
>
> OCL<?, EClassifier, EOperation, ?, ?, ?, ?, ?, ?, Constraint, EClass,
> EObject> ocl;
> ocl = OCL.newInstance(EcoreEnvironmentFactory.INSTANCE);
> OCLHelper<EClassifier, EOperation, ?, Constraint> helper =
> ocl.createOCLHelper();
> helper.setContext(eClass);
> OCLExpression<EClassifier> query =
> helper.createQuery(attribute.getpOCLStatement());
>
>
>
> Why impact analyzer is using org.eclipse.ocl.ecore.OCLExpression and
> do this mean i have to extend AbstractVisitor or some other to get
> object of org.eclipse.ocl.ecore.OCLExpression ?
>
> how can i get org.eclipse.ocl.ecore.OCLExpression object?
>
> please help
>
> Warmest Regards
>
|
|
|
Goto Forum:
Current Time: Tue Sep 24 15:54:51 GMT 2024
Powered by FUDForum. Page generated in 0.12120 seconds
|