Manual Notificatios [message #423394] |
Mon, 29 September 2008 16:06  |
Eclipse User |
|
|
|
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 16:18   |
Eclipse User |
|
|
|
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
>
|
|
|
Re: Manual Notificatios [message #423399 is a reply to message #423397] |
Mon, 29 September 2008 16:30  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.26344 seconds