Skip to main content



      Home
Home » Modeling » EMF » Array of references in model
Array of references in model [message #1405095] Wed, 06 August 2014 11:19 Go to next message
Eclipse UserFriend
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 13:59 Go to previous message
Eclipse UserFriend
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:Generic valueType for EMap
Next Topic:Filtering Attributes
Goto Forum:
  


Current Time: Wed Jul 23 10:12:41 EDT 2025

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

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

Back to the top