Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to correctly compare EDataType?
How to correctly compare EDataType? [message #1064885] Fri, 21 June 2013 14:08 Go to next message
Michael Vorburger is currently offline Michael VorburgerFriend
Messages: 103
Registered: July 2009
Senior Member
Can anyone enlighten me why I have to do the horrible hack in https://github.com/vorburger/efactory/commit/3464ba71f6fc0d50e03f0bec428b2cf17fee3c88, or how to avoid / do correctly compare EDataType for equality?

The problem which made me do this is illustrated by the https://github.com/vorburger/efactory/blob/master/com.googlecode.efactory.tests/src/com/googlecode/efactory/xcore/tests/XcoreTest.java - somehow an EcorePackage.Literals.EINT isn't always an EcorePackage.Literals.EINT, like a say java.lang.Integer is always an java.lang.Integer?

Or maybe what that kind of code really wants to do isn't comparing EDataType for equality, but their.. what, their InstanceClass(Name?) or InstanceTypeName?

I stumbled over this in the context of http://blog2.vorburger.ch/2013/06/efactory-ii-xobjects-ehutn.html, when trying it out with Xcore.
Re: How to correctly compare EDataType? [message #1064893 is a reply to message #1064885] Fri, 21 June 2013 14:16 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Michael,

Comments below.

On 21/06/2013 4:08 PM, Michael Vorburger wrote:
> Can anyone enlighten me why I have to do the horrible hack in
> https://github.com/vorburger/efactory/commit/3464ba71f6fc0d50e03f0bec428b2cf17fee3c88,
> or how to avoid / do correctly compare EDataType for equality?
There's always the possibility to have both the generated runtime
version of a package, as well as the dynamically loaded development time
version.
> The problem which made me do this is illustrated by the
> https://github.com/vorburger/efactory/blob/master/com.googlecode.efactory.tests/src/com/googlecode/efactory/xcore/tests/XcoreTest.java
> - somehow an EcorePackage.Literals.EINT isn't always an
> EcorePackage.Literals.EINT, like a say java.lang.Integer is always an
> java.lang.Integer?
Not sure about that statement, but yes, it's possible to end up with the
EPackage instances from
platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore, which looks
suspiciously just like the generated instance in EcorePackage.eINSTANCE.
> Or maybe what that kind of code really wants to do isn't comparing
> EDataType for equality, but their.. what, their InstanceClass(Name?)
> or InstanceTypeName?
It depends on what you're trying to accomplish. Generally if they're
not == they're different instances and hence different. Under what
circumstances would you want two such things to be considered "the
same"? Perhaps if the eDataType.getEPackage().getNsURI() values are
equal and the data type's names are the same. In that case it's very
likely they represent the runtime and development time versions of "the
same" data type.
> I stumbled over this in the context of
> http://blog2.vorburger.ch/2013/06/efactory-ii-xobjects-ehutn.html,
> when trying it out with Xcore.
Xcore consistently (I hope) tries to use the development time version of
the Ecore model whereas Ecore models creating with the Sample Ecore
Editor will tend to use the runtime version of Ecore (for the data types)...


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: How to correctly compare EDataType? [message #1064921 is a reply to message #1064893] Fri, 21 June 2013 16:14 Go to previous message
Michael Vorburger is currently offline Michael VorburgerFriend
Messages: 103
Registered: July 2009
Senior Member
Ed, thank you for your as always very quick response - I think I get it re. the development time version vs. runtime!
Previous Topic:[EMF] Find out if a file is a model,
Next Topic:[CDO] non ordered list
Goto Forum:
  


Current Time: Fri Mar 29 00:47:54 GMT 2024

Powered by FUDForum. Page generated in 0.03007 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top