Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Notifications for bidirectional references
Notifications for bidirectional references [message #129929] Thu, 02 October 2008 02:25 Go to next message
chengdong is currently offline chengdongFriend
Messages: 17
Registered: July 2009
Junior Member
Case:

class A{
EList<B> links;
}

class B{
EList<A> revLinks;
}

The links and revLinks are set as bidirectional references.

The problem happens in following code:
1 A a;
2 B b1, b2;
3 ... call factory to create a and b1, b2 ...
4 a.getLinks().add(b1);
5 a.getLinks().add(b2);

There is inconsistency for line 4 and line5:
line 4: only fire 1 ViewerNotification for adding b1 to a
line 5: fire 2 ViewerNotifications for adding a to b1.revLinks and
adding b1 to a.links

Can someone explain this to me why there is different behavior in line 4
and 5? Is this a bug in EMF?

Thanks

-chengdong
Re: Notifications for bidirectional references [message #129941 is a reply to message #129929] Thu, 02 October 2008 12:10 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 31035
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090602030602040504000302
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Chengdong,

This is really an EMF question. Please use the EMF newsgroup next time.
<news://new.eclipse.org/eclipse.tools.emf>

news://new.eclipse.org/eclipse.tools.emf


chengdong wrote:
> Case:
> class A{
> EList<B> links;
> }
>
> class B{
> EList<A> revLinks;
> }
>
> The links and revLinks are set as bidirectional references.
>
> The problem happens in following code:
> 1 A a;
> 2 B b1, b2;
> 3 ... call factory to create a and b1, b2 ...
> 4 a.getLinks().add(b1);
> 5 a.getLinks().add(b2);
>
> There is inconsistency for line 4 and line5:
> line 4: only fire 1 ViewerNotification for adding b1 to a
> line 5: fire 2 ViewerNotifications for adding a to b1.revLinks and
> adding b1 to a.links
>
> Can someone explain this to me why there is different behavior in line
> 4 and 5? Is this a bug in EMF?
I don't really see how 5 affects b1 at all. In general, whether a
viewer notification is fired will depend on whether there's an adapter
attached to the b objects. If the b objects are new objects, they
likely don't have an adapter attached to them yet because nothing was
viewing them yet...
>
> Thanks
>
> -chengdong
>

--------------090602030602040504000302
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Chengdong,<br>
<br>
This is really an EMF question.
Re: Notifications for bidirectional references [message #620329 is a reply to message #129929] Thu, 02 October 2008 12:10 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 31035
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090602030602040504000302
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Chengdong,

This is really an EMF question. Please use the EMF newsgroup next time.
<news://new.eclipse.org/eclipse.tools.emf>

news://new.eclipse.org/eclipse.tools.emf


chengdong wrote:
> Case:
> class A{
> EList<B> links;
> }
>
> class B{
> EList<A> revLinks;
> }
>
> The links and revLinks are set as bidirectional references.
>
> The problem happens in following code:
> 1 A a;
> 2 B b1, b2;
> 3 ... call factory to create a and b1, b2 ...
> 4 a.getLinks().add(b1);
> 5 a.getLinks().add(b2);
>
> There is inconsistency for line 4 and line5:
> line 4: only fire 1 ViewerNotification for adding b1 to a
> line 5: fire 2 ViewerNotifications for adding a to b1.revLinks and
> adding b1 to a.links
>
> Can someone explain this to me why there is different behavior in line
> 4 and 5? Is this a bug in EMF?
I don't really see how 5 affects b1 at all. In general, whether a
viewer notification is fired will depend on whether there's an adapter
attached to the b objects. If the b objects are new objects, they
likely don't have an adapter attached to them yet because nothing was
viewing them yet...
>
> Thanks
>
> -chengdong
>

--------------090602030602040504000302
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Chengdong,<br>
<br>
This is really an EMF question.
Previous Topic:Notifications for bidirectional references
Next Topic:Re: emf compare
Goto Forum:
  


Current Time: Mon Apr 06 22:17:14 GMT 2020

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

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

Back to the top