Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Do bounds (lower and upper) of EReference have any effect?
Do bounds (lower and upper) of EReference have any effect? [message #623136] Thu, 12 August 2010 10:58 Go to next message
Oleg Bolshakov is currently offline Oleg Bolshakov
Messages: 36
Registered: August 2010
Member
There two classes (Class1 and Class2) and EReferences between them in EMF model (,ecore file). EReferences multyplicity's are 0..* for src role and 0..3 for dst role. I can see two ELists created for each class but I can add any count of objects to any of the lists. The question is - is there a realisation of EReference's bounds (for example upper bound) and why doesn't it have any effect in my Java code?

Here is the code:

Package1.impl.Package1FactoryImpl.init();

Package1.meta.Package1Factory factory = Package1.meta.Package1Factory.eINSTANCE;

Class1 object1 = factory.createClass1();
object1.setName1("object1");

Class2 object2 = factory.createClass2();
object2.setName2("object2");

<...>

EList<Class1> dests = object2.getDst();
dests.add(object1);
dests.add(object7);
dests.add(object8);
dests.add(object9);
dests.add(object10);
dests.add(object11);
dests.add(object12);

<...>
Re: Do bounds (lower and upper) of EReference have any effect? [message #623139 is a reply to message #623136] Thu, 12 August 2010 16:25 Go to previous message
Ed Willink is currently offline Ed Willink
Messages: 4098
Registered: July 2009
Senior Member
Hi Rrock

The bounds are used when you validate(). In practice performing
too-fine-grained validation is awkward. For instance changing an element
in an exactly two-off list is not possible using just the add/remove
list protocol.

If you use EMF Validation's live validation, they are checked more often.

Regards

Ed Willink

On 12/08/2010 11:58, Rrock wrote:
> There two classes (Class1 and Class2) and EReferences between them in
> EMF model (,ecore file). EReferences multyplicity's are 0..* for src
> role and 0..3 for dst role. I can see two ELists created for each class
> but I can add any count of objects to any of the lists. The question is
> - is there a realisation of EReference's bounds (for example upper
> bound) and why doesn't it have any effect in my Java code?
>
> Here is the code:
>
> Package1.impl.Package1FactoryImpl.init();
>
> Package1.meta.Package1Factory factory =
> Package1.meta.Package1Factory.eINSTANCE;
>
> Class1 object1 = factory.createClass1();
> object1.setName1("object1");
>
> Class2 object2 = factory.createClass2();
> object2.setName2("object2");
>
> <...>
>
> EList<Class1> dests = object2.getDst();
> dests.add(object1);
> dests.add(object7);
> dests.add(object8);
> dests.add(object9);
> dests.add(object10);
> dests.add(object11);
> dests.add(object12);
>
> <...>
Previous Topic:Do bounds (lower and upper) of EReference have any effect?
Next Topic:Emfatic download
Goto Forum:
  


Current Time: Sat Oct 25 19:14:04 GMT 2014

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

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