Generate some child in my ecore model

Thibault Santonja

To simplify my question I've made a little model of my problem.

In this model, I have a Plane in a Simulation. I would like to generate with a little piece of code, some other Plane with the same children classes (MotorType, OtherClass1, OtherClass2) and the same values except the numeric value in MotorType that is incremented with each iteration.

For example, I have a Simulation comprised of a Plane named "plane1", with a MotorType=TypeB with the value 10, and an OtherClass1.

I would like to generate 10 new planes, with OtherClass1 with the same values and the same MotorType, but with the "value" incremented by 10.

How can I generate some new plane child of my simulation that is a copy of an existing plane but with an incrementation of a parameter ?
Is it possible to do this with Sirius by a right click on my plane to copy ?

Example of my model class diagram
Example of a creation of a simulation

user1292456

You probably want to use EcoreUtil.copy(EObject) on your original Simulation to create your copy.

Then, using the Java EMF APIs you can navigate inside your copy and alter it however you wish to.

If you want each Simulation to be in its own file, you will have to create the appropriate EMF Resource and add your newly-created Simulation to its contents before saving it.

After you have implemented the Java method that does all the above, you can call it from a Sirius diagram using a Java service

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

XText Ecore Model to XText Code

From Dev

Loading XML file into ecore model (Deserialisation)

From Dev

How to generate exe file with some settings from my application

From Dev

How to generate exe file with some settings from my application

From Dev

Rails 4 generate add underscore to my model name

From Dev

Microsoft Solver Foundation could not solve my model in some cases

From Dev

Select Parent and Child Collection to a List of some model simultaniously in C# Linq

From Dev

Groupbox control IsEnabled state not propagated to child button when that button's IsEnabled is bound to some view model

From Dev

How to generate some keyword?

From Dev

ADO.NET data model generate from database is leaving out one of my tables

From Dev

Trying to generate a Keras model with my own data instead of cifar10

From Dev

Why does my entity framework model only return a single child even though there are multiple children in the relationships?

From Dev

"rails generate model" hangs

From Dev

Generate actionlinks with model data

From Dev

Accessing the child in the model

From Dev

How to generate data for the child component?

From Dev

Why glutSolidTorus generate some flaw

From Dev

Ecore EClass inheritance in Xtext

From Dev

ECore reflection and cross references

From Dev

Rails generate model + migration for subclass

From Dev

Generate EMF Model via Gradle

From Dev

How to generate this model in Ruby on Rails

From Dev

How to generate Moving Average model

From Dev

CodeFirst Model - cant generate dataBase

From Dev

Rails generate model including validations?

From Dev

Generate MEL to rebuild a model in Maya

From Dev

CodeFirst Model - cant generate dataBase

From Dev

Rails cannot generate model with mysql

From Dev

Yii generate model without Gii

Related Related

  1. 1

    XText Ecore Model to XText Code

  2. 2

    Loading XML file into ecore model (Deserialisation)

  3. 3

    How to generate exe file with some settings from my application

  4. 4

    How to generate exe file with some settings from my application

  5. 5

    Rails 4 generate add underscore to my model name

  6. 6

    Microsoft Solver Foundation could not solve my model in some cases

  7. 7

    Select Parent and Child Collection to a List of some model simultaniously in C# Linq

  8. 8

    Groupbox control IsEnabled state not propagated to child button when that button's IsEnabled is bound to some view model

  9. 9

    How to generate some keyword?

  10. 10

    ADO.NET data model generate from database is leaving out one of my tables

  11. 11

    Trying to generate a Keras model with my own data instead of cifar10

  12. 12

    Why does my entity framework model only return a single child even though there are multiple children in the relationships?

  13. 13

    "rails generate model" hangs

  14. 14

    Generate actionlinks with model data

  15. 15

    Accessing the child in the model

  16. 16

    How to generate data for the child component?

  17. 17

    Why glutSolidTorus generate some flaw

  18. 18

    Ecore EClass inheritance in Xtext

  19. 19

    ECore reflection and cross references

  20. 20

    Rails generate model + migration for subclass

  21. 21

    Generate EMF Model via Gradle

  22. 22

    How to generate this model in Ruby on Rails

  23. 23

    How to generate Moving Average model

  24. 24

    CodeFirst Model - cant generate dataBase

  25. 25

    Rails generate model including validations?

  26. 26

    Generate MEL to rebuild a model in Maya

  27. 27

    CodeFirst Model - cant generate dataBase

  28. 28

    Rails cannot generate model with mysql

  29. 29

    Yii generate model without Gii

HotTag

Archive