|
|
|
|
Re: Operation overriding : is this a bug in pivot delegates? [message #1037196 is a reply to message #1037174] |
Tue, 09 April 2013 09:17 |
ModelGeek Mising name Messages: 550 Registered: June 2011 |
Senior Member |
|
|
I am using Pivot. There can be two ways to do that.
You can use given XMI file :
Please create new empty emf project. Import attached ecore and xmi files.
Open XMI file with "Sample Reflective Ecore editor" or with "General EMF editor". Select root object "Tester". It will show error.
Create new XMI file(better for understanding problem):
create ecore with following
import ecore : 'http://www.eclipse.org/emf/2002/Ecore#/';
package temp : Test = 'http://www.eclipse.org/mdt/ocl/oclinecore/tutorial'
{
class super
{
operation getValue() : ecore::EDouble
{
body: 2;
}
operation getConnections() : super[*]
{
body: if target->notEmpty() then
target->collect(as : super | as.getConnections())->asSet()->union(target)
else
let next : Set(super) = Set{} in
next
endif;
}
property source#target : super[*];
property target#source : super[*] { ordered composes };
}
class Tester
{
attribute total : ecore::EDoubleObject { derived volatile }
{
derivation: self.super.getConnections().getValue()->sum();
}
property super : super[*] { composes };
}
class Child1 extends super
{
operation getValue() : ecore::EDouble
{
body: 1;
}
operation getConnections() : super[*]
{
body: if child2->isEmpty() then
child2.oclAsType(super)->collect(as : super | as.getConnections())->asSet()->union(child2)
else
let next : Set(super) = Set{} in
next
endif;
}
property child2#child1 : Child2[*];
}
class Child2 extends super
{
operation getValue() : ecore::EDouble
{
body: 1.5;
}
property child1#child2 : Child1[*] { ordered };
}
}
then open with "Sample Ecore Editor". Right click on "Tester" class and choose "Create Dynamic Instance". XMI file will be created. Open newly created XMI file in "Sample Reflective Ecore editor" and right click "Tester" and select menu add child -> "Super Super". It will add new instance of super. Now right click on newly created super object and and select menu add child -> "Super Super". It will also add new instance of super. Now if you will select root tester object and goto properiest pane, it will be showing you total = 2.
Now select the last added super object and right click and choose add child -> "Target Child1". Select the root Tester object and here it will be error.
child1 class is overriding methods available in super class and it seems like a bug in pivot.
[Updated on: Tue, 09 April 2013 09:37] Report message to a moderator
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03991 seconds