Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Best place to create an instance of an external referenced emf model element?
Best place to create an instance of an external referenced emf model element? [message #1782950] Mon, 05 March 2018 14:36 Go to next message
Chris X is currently offline Chris XFriend
Messages: 60
Registered: November 2017
Member
Hi guys,

in my language it's possible to create an instance of an model element that is defined in a external emf model.

For example the external model has a book with the name "XY" and with the attribute pages = 230.

Now in my language it should be possible to create a copy of such a book and to access the attributes

set books::book<XY> as bookCopy
bookCopy.pages = 120


What is the best way to implement this and where? So at the and I need a dynamic created model that holds all these dynamically create books.

It would be nice to get a list of the main steps to implement such a feature.

Many thanks and have a nice day



Re: Best place to create an instance of an external referenced emf model element? [message #1782953 is a reply to message #1782950] Mon, 05 March 2018 15:07 Go to previous messageGo to next message
Chris X is currently offline Chris XFriend
Messages: 60
Registered: November 2017
Member
Additionally I need the following behavior:

set books::book<XY> as bookCopy

var x = bookCopy.pages+4 
// x has the value 234
bookCopy.pages = 12
// bookCopy.pages has the value 12
x= 100
// x has the value 100
x = x + bookCopy.pages;  // At this line x on the right side of the assignment has the value 100.


How do I now what's the current value of x (depending on the line)? I think it's the job of the interpreter or an evaluator. But is there in example how to implement such an evaluator?

Re: Best place to create an instance of an external referenced emf model element? [message #1782954 is a reply to message #1782953] Mon, 05 March 2018 15:24 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
do you know the concept of an IDerived state Computer?
and the place would be slots 1 to n in resource.contents.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Best place to create an instance of an external referenced emf model element? [message #1782956 is a reply to message #1782954] Mon, 05 March 2018 15:37 Go to previous messageGo to next message
Chris X is currently offline Chris XFriend
Messages: 60
Registered: November 2017
Member
Yes okay it's also the DerivedState-Computer. Then I'm happy ;)

Can you tell be the use-case of the DerivedState-Computer. So when should I use it and when not? This is currently not clear for me.



Re: Best place to create an instance of an external referenced emf model element? [message #1782957 is a reply to message #1782956] Mon, 05 March 2018 15:42 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
it is used to do a model2model transformation of the current model

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Best place to create an instance of an external referenced emf model element? [message #1782970 is a reply to message #1782957] Mon, 05 March 2018 20:23 Go to previous message
Chris X is currently offline Chris XFriend
Messages: 60
Registered: November 2017
Member
Hi Christian,

thanks !!! This was still not clear for me ;)

Previous Topic:cross-references in grammar.
Next Topic:How to disable cross-resource reference
Goto Forum:
  


Current Time: Thu Apr 25 07:15:08 GMT 2024

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

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

Back to the top