Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Array of references in model
Array of references in model [message #1405095] Wed, 06 August 2014 15:19 Go to next message
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 428
Registered: September 2009
Senior Member
I need to model a (short) array of references in one of my classes.
AFAIK these are implemented using ELists in EMF.
Problem is I need to keep track of element order *AND* I may have multiple NULL entries.
Is this supported?
I tried setting nullable and !unique in ecore, but I see malfunctioning (apparently iterations stop at first null found).
For very short arrays I used multiple references, but that rapidly becomes impractical when array lenght grows above a handful elements.
What is the right way to do this?

TiA
Mauro
Re: Array of references in model [message #1405151 is a reply to message #1405095] Wed, 06 August 2014 17:59 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 28978
Registered: July 2009
Senior Member
Mauro,

Comments below.

On 06/08/2014 5:20 PM, Mauro Condarelli wrote:
> I need to model a (short) array of references in one of my classes.
Model and array are kind of mutually exclusive...
> AFAIK these are implemented using ELists in EMF.
> Problem is I need to keep track of element order *AND* I may have
> multiple NULL entries.
Yes, you can't have nulls in EObject ELists.
> Is this supported?
No.
> I tried setting nullable
Nullable? What's that?
> and !unique in ecore, but I see malfunctioning (apparently iterations
> stop at first null found).
> For very short arrays I used multiple references, but that rapidly
> becomes impractical when array lenght grows above a handful elements.
> What is the right way to do this?
You can't model an array of references and you can't have nulls, nor
even duplicates, in EObject ELists. Presumably you want some type of
cross reference. The best I can suggest is to model a containment
reference of place holder objects that in turn hold the references. You
could provide an operation that returns the list of references and
implement that list so it's mutable, i.e., it's effectively derived from
the list of placeholder objects so any modification to the list is a
modification of the underlying placeholder list, i.e., something like we
Ecore itself does for eSuperTypes which is derived from
eGenericSuperTypes, but is also directly modifiable, but keep in mind
that you ought not define a derived reference because nothing in the
framework will be happy to find null in a reference list...
>
> TiA
> Mauro
Previous Topic:Filtering Attributes
Next Topic:Refresh View Programmatically
Goto Forum:
  


Current Time: Fri Nov 24 01:39:22 GMT 2017

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

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