Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 265066 - Expose EvaluationVisitorImpl class as API
Summary: Expose EvaluationVisitorImpl class as API
Status: CLOSED FIXED
Alias: None
Product: OCL
Classification: Modeling
Component: Core (show other bugs)
Version: 1.2.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Radomil Dvorak CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-16 17:38 EST by Radomil Dvorak CLA
Modified: 2011-05-27 02:49 EDT (History)
1 user (show)

See Also:


Attachments
Expose EvaluationVisitorImpl (162.41 KB, patch)
2009-02-23 08:07 EST, Radomil Dvorak CLA
give.a.damus: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Radomil Dvorak CLA 2009-02-16 17:38:50 EST
As per discussion in bug #261128, there was a couple of reasons that justified this class to be made internal.

The EvaluationVisitorImpl class extends AbstractEvaluationVisitor which is part of the API. The concrete visitor adds nothing more visible to the client, so I would see nearly zero refactoring effort to expose it as API.

MDT OCL design promotes using visitor composition, which is pretty useful for adding generic interception features.
However, based on QVTo experience, I think it's more straightforward to use extension of this class to add a new evaluation functionality.

Before suggesting a very small refinement of this class ;),
just asking, would this be OK for MDT OCL?
Comment 1 Radomil Dvorak CLA 2009-02-19 17:25:29 EST
Sorry for nagging ;), 
this enhancement seems to be quite important for the QVTo component.
Thoughts? If it make sense I can provide a patch.
Comment 2 Christian Damus CLA 2009-02-20 07:17:58 EST
Sorry, Radek.  You shouldn't have to nag.

Yes, attach a patch, and I'll assess the damage  ;-)
Comment 3 Radomil Dvorak CLA 2009-02-23 08:07:17 EST
Created attachment 126448 [details]
Expose EvaluationVisitorImpl

I have moved the 'EvaluationVisitorImpl' class to 'org.eclipse.ocl' package, 
not sure if this is a good place for ...Impl class. You will decide ;)

Additionally, I have added operation 'AbstractEvaluationVisitor.setEvaluationEnvironment(EvaluationEnvironment',
which allows for switching evaluation environments as the evaluation moves accross stack frames.

I can see the operations bellow create a nested evaluation environment along with a new
visitor instance to perform a body evaluation.
 protected Object call(O, OCLExpression<C>, Object, Object[]);
 protected Object navigate(P, OCLExpression<C>, Object);

To my understanding, the same could be done by using a shared visitor instance, setting
the nested evironment to the visitor before the call and resetting to the original one after.
This way we would ensure that eventual decorating visitors will get involved in body expressions
evaluation, which does not seem to be the case know.
What do you think?
Comment 4 Radomil Dvorak CLA 2009-03-05 16:44:13 EST
Christian, could you please consider resolution of this bugzilla for M6 target?
Comment 5 Christian Damus CLA 2009-03-11 09:07:55 EDT
Patch committed to HEAD (1.3 branch), with addition of @since tags where needed.  Somebody forgot their API tooling set-up!  ;-)

(In reply to comment #3)
> I can see the operations bellow create a nested evaluation environment along
> with a new
> visitor instance to perform a body evaluation.
> protected Object call(O, OCLExpression<C>, Object, Object[]);
> protected Object navigate(P, OCLExpression<C>, Object);
> 
> To my understanding, the same could be done by using a shared visitor instance,
> setting
> the nested evironment to the visitor before the call and resetting to the
> original one after.
> This way we would ensure that eventual decorating visitors will get involved in
> body expressions
> evaluation, which does not seem to be the case know.
> What do you think?

Yes, that sounds like a good idea.  It's definitely not good that decorators currently miss the nested environments.

Please raise a separate bug for this problem.
Comment 6 Ed Willink CLA 2011-05-27 02:49:13 EDT
Closing after over 18 months in resolved state.