Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Manual Notificatios
Manual Notificatios [message #423394] Mon, 29 September 2008 20:06 Go to next message
Alex Boyko is currently offline Alex BoykoFriend
Messages: 200
Registered: July 2009
Senior Member
Hi,

I'd like to model an object (a property container object) with a list of
elements where each element in the list is Property EDataType). Also, I'd
like this object to have a small memory footprint.
Option 1. Create an object and declare properties as a "many" Attribute of
type Property EDataType. This will introduce an EList.
Option 2. Create EDataType for Properties that will contain a Property[]
array and work with it manually through putProperty() and getProperty()
operations declared on modeled property container object. eNotify(..) will
be cellaed manually where old and new object in the notification event are
old and new Property (not Properties). In this case I'd have to hack a bit
to get the undo working, i.e. in eSet(...) for the properties attribute
check the instance of the passed object. If it's Property then call
putProperty otherwise normal behavior.

I wonder if option 2 will save anything memory-wise and whether there are
more problems with it than just the undo. Perhaps, it would be better just
to extend the EList or the BasicEList (whatever is generated from option
1) and play around with it to get the desired small size of the object if
possible?

Thanks in advance.

Cheers,
Alex
Re: Manual Notificatios [message #423397 is a reply to message #423394] Mon, 29 September 2008 20:18 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Alex,

Comments below.


Alex Boyko wrote:
> Hi,
>
> I'd like to model an object (a property container object) with a list
> of elements where each element in the list is Property EDataType).
> Also, I'd like this object to have a small memory footprint.
> Option 1. Create an object and declare properties as a "many"
> Attribute of type Property EDataType. This will introduce an EList.
> Option 2. Create EDataType for Properties that will contain a
> Property[] array and work with it manually through putProperty() and
> getProperty() operations declared on modeled property container
> object. eNotify(..) will be cellaed manually where old and new object
> in the notification event are old and new Property (not Properties).
> In this case I'd have to hack a bit to get the undo working, i.e. in
> eSet(...) for the properties attribute check the instance of the
> passed object. If it's Property then call putProperty otherwise normal
> behavior.
>
> I wonder if option 2 will save anything memory-wise and whether there
> are more problems with it than just the undo. Perhaps, it would be
> better just to extend the EList or the BasicEList (whatever is
> generated from option 1) and play around with it to get the desired
> small size of the object if possible?
EMF's lists, like java.util.ArrayList have very little footprint. Are
you trying to optimize something that's a known issue or just planning
ahead for anticipated issues. I.e., are you expecting a huge number of
such lists? Even if you are, the overhead of the object that owns the
list will dwarf the overhead of the list. You might fiddle with the
grow method if the number of unused array slots is an issue...
>
> Thanks in advance.
>
> Cheers,
> Alex
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Manual Notificatios [message #423399 is a reply to message #423397] Mon, 29 September 2008 20:30 Go to previous message
Alex Boyko is currently offline Alex BoykoFriend
Messages: 200
Registered: July 2009
Senior Member
Hi Ed,

Thanks for the reply.

I'm planning ahead. Basically, I'm going to have a lot of these properties
containers objects, where if one container doesn't have a property, the
parent of the container is asked for the same property. So properties are
inherited and these arrays of properties will be rather small. Therefore,
my main concern is really the number of empty slots, which you already
guessed :-)
Therefore, I'll use your advice regarding the grow method.
Thanks.

Cheers,
Alex
Previous Topic:Handling Resource moves in Workspace
Next Topic:[Teneo] Exception using ManyToMany annotation
Goto Forum:
  


Current Time: Fri Apr 26 01:29:39 GMT 2024

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

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

Back to the top