|
|
|
Re: EOL .add alternative required [message #631879 is a reply to message #631693] |
Sat, 09 October 2010 18:09 |
Dimitrios Kolovos Messages: 1776 Registered: July 2009 |
Senior Member |
|
|
Hi James,
Unfortunately, I'm not able to reproduce this. I'm using the following
metamodel:
@namespace(uri="uniquetest", prefix="uniquetest")
package uniquetest;
class Root {
unique ref Obj[*] uniqueVal;
!unique ref Obj[*] nonUniqueVal;
}
class Obj {
attr String name;
}
and the following EOL script:
var root = new Root;
var a = new Obj;
root.uniqueVal.add(a);
root.uniqueVal.add(a);
root.uniqueVal.size().println();
var b = new Obj;
root.nonUniqueVal.add(b);
root.nonUniqueVal.add(b);
root.nonUniqueVal.size().println();
and what I'm getting in the console is
1
2
which is consistent with what I'd expect. Could you please send me your
metamodels/models/transformations etc at epsilon.devs at gmail dot com
so that I can have a look?
Cheers,
Dimitris
On 08/10/2010 14:38, James Sharp wrote:
> Hi Dimitris,
>
> I have added the !unique flag and regenerated my meta-model but this
> does not seem to have made a difference.
>
> I added some print lines to try and discover what is happening and the
> addition of the not unique flag to the emf model seems to have made no
> difference?
>
> The meta-model (in ecore and genmodel formats) both show that the
> reference ParameterList to ParameterItems is ordered but not unique
> (also resolvable proxy and changable are set to true - all other feature
> options are false).
>
> Your documetation suggests that the add method will not create duplicate
> entries on a set. From my understanding an ecore reference is stored as
> an EList, and appears as such in the Java source for the meta-model.
>
> Should I still be using the add method (I have tried eSet but I receive
> an error that the method does not exist).
>
> I have also performed a sanity check and all the refeences in the source
> model are being traversed.
>
> Any idea's on how to fix this would be greatly appreciated, feeling a
> bit new and out of my depth.
>
> Many thanks,
>
> James
>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03395 seconds