Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [qvto-dev] coerceValue()

Hi Hang,

This method stems from the fact that EObject reflection method eGet() declares the return type as Object. So any instance including lists (collections) can be returned. And this method checks the multiplicity of result and converts from Object (which is mapped to OclAny) to appropriate collection if needed and vise versa.

Originally it is defined in EcoreEvaluationEnvironment. And QvtOperationalEvaluationEnv has provided an overridden method in course of fixing the bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=386115 (Dynamic calls on multi values references return single object not collections), also see Wiki https://wiki.eclipse.org/MMT/QVTo/New_and_Noteworthy/Luna.

Behavior of 'copy' parameter should be investigated further. Technically OCL collections are not mutable and every operation which produce collection as its result actually creates the new copy. So it's possible that 'copy' should be 'true' only for mutable types like List.

Regards,
  Sergey.



On Fri, Oct 31, 2014 at 5:39 PM, Liu, H. <h.liu.1@xxxxxx> wrote:

Dear QVTo developers:

 

I’m from a group of people who are working on optimizing QVTo engine recently.

 

We profiled the QVTo engine.

 

One of the method we found that takes time is the coerceValue() method.

It is located in

 

After some investigation, I’m still not exactly clear about what this method is used for.

 

The coerceValue(ETypedElement element, Object value, boolean copy) method is called in two places,

 

the callOperation() method and the navigateProperty() method.

 

In both call, the parameter copy is set to true.

For my understanding, this means if the parameter value is of type collection, it will be copied to a new collection as an output.

 

So my question is why this parameter is always set to true?

Is there possibilities that this parameter can be set to false, so it don’t need to create new collections, which might save time?

 

Best regards,

Hang


_______________________________________________
qvto-dev mailing list
qvto-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/qvto-dev


Back to the top