Home » Modeling » Epsilon » adding new element F to Containmentreference(I am using EOL to change an emf model that an instance of emf metamodel)
adding new element F to Containmentreference [message #1755257] |
Wed, 01 March 2017 12:36  |
Eclipse User |
|
|
|
Hi ,
I am using the following code to add new element type task to D2 which is a processor . task is the Containmentreference between the processor and task that means parent of task is processor D2.
I got error says that Property 'eRef' not found in object processor [name=D2, multiplicity=1, speedfactor=1.0, scheduling=default, replication=1, quantum=0.0, ]
[ var vprocessor=Lqn!processor;
for (p in vprocessor){
p.name=getName(SrightId);//this operation returns name of processor D2
"D2 ".print()+p.name.println();
var target=Lqn!task;
var t:new Lqn!task;
t.name=getName(valueIdS);\\return task its name is F
for (g in target){
var parentSource=g.closure(x | x.eContainer()) ;
"parent of task ".print()+parentSource.first().eClass.name.println();
var eRef=t.closure(x | x.eContainmentFeature);
"Containmentreference".print()+eRef.println();
var type=parentSource.eClass.println();
p.eRef.name.add(t);
}
} ][/code]
Can you please help me .
Metamodel and instance of metamodel are attached
[Updated on: Wed, 01 March 2017 12:39] by Moderator
|
|
| | | |
Re: adding new element F to Containmentreference [message #1755358 is a reply to message #1755285] |
Thu, 02 March 2017 10:50   |
Eclipse User |
|
|
|
Hi Dimitris,
I tried to test my metamodel with this code: var tasks = Lqn!task;
for (p in tasks ){
"parent".print()+ p.asSequence().closure(x | x.eContainer()).println();
var eRef :Sequence =p.closure(x | x.eContainmentFeature);
"eRef ".print()+ eRef.println;
Then i got this in the console:
parentSequence {processor [name=D1, multiplicity=1, speedfactor=1.0, scheduling=default, replication=1, quantum=0.0, ], lqnmodel [name=model To lqn, description=null, lqnSchemaVersion=1, lqnCoreSchemaVersion=1, xmldebug=false, ]}
eRef Sequence {EReference [name=task, ordered=true, unique=true, lowerBound=1, upperBound=-1, many=true, required=true, changeable=true, volatile=false, transient=false, defaultValueLiteral=null, defaultValue=null, unsettable=false, derived=false, containment=true, container=false, resolveProxies=true, ], EReference [name=eStructuralFeatures, ordered=true, unique=true, lowerBound=0, upperBound=-1, many=true, required=false, changeable=true, volatile=false, transient=false, defaultValueLiteral=null, defaultValue=null, unsettable=false, derived=false, containment=true, container=false, resolveProxies=false, ]}
parentSequence {processor [name=D2, multiplicity=1, speedfactor=1.0, scheduling=default, replication=1, quantum=0.0, ], lqnmodel [name=model To lqn, description=null, lqnSchemaVersion=1, lqnCoreSchemaVersion=1, xmldebug=false, ]}
eRef Sequence {EReference [name=task, ordered=true, unique=true, lowerBound=1, upperBound=-1, many=true, required=true, changeable=true, volatile=false, transient=false, defaultValueLiteral=null, defaultValue=null, unsettable=false, derived=false, containment=true, container=false, resolveProxies=true, ], EReference [name=eStructuralFeatures, ordered=true, unique=true, lowerBound=0, upperBound=-1, many=true, required=false, changeable=true, volatile=false, transient=false, defaultValueLiteral=null, defaultValue=null, unsettable=false, derived=false, containment=true, container=false, resolveProxies=false, ]}
for each processor (parent) there are tasks (children) and i tried to add new task to processor p=D2 by this code :
p.task.add(t); it did work but when i replaced task with a variable eRef it generated the error.
Cheers,
Taghreed
[Updated on: Thu, 02 March 2017 11:02] by Moderator
|
|
| | | | | |
Goto Forum:
Current Time: Wed Jul 23 13:43:08 EDT 2025
Powered by FUDForum. Page generated in 0.06383 seconds
|