|
Re: Ordered property not taken into account for equality checks ? [message #755174 is a reply to message #755090] |
Mon, 07 November 2011 15:35 |
Ed Merks Messages: 33141 Registered: July 2009 |
Senior Member |
|
|
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Cedric,<br>
<br>
Comments below.<br>
<br>
On 07/11/2011 12:09 PM, Cedric Moonen wrote:
<blockquote cite="mid:j98dgl$vkm$1@news.eclipse.org" type="cite">I
my model I have a containement relation between two EClasses with
the upper bound set to -1 (so Class1 contains a list of Class2). I
have set the "Ordered" property on this relation to "false" but
apparently this is not taken into account when checking if the
lists are equals.
<br>
</blockquote>
No, because equality for lists is defined by Java, so order must
always be respected.<br>
<blockquote cite="mid:j98dgl$vkm$1@news.eclipse.org" type="cite">
<br>
Here is the code that checks for the equality of the lists (taken
from the EqualityHelper class):
<br>
public boolean equals(List<EObject> list1,
List<EObject> list2)
<br>
{
<br>
int size = list1.size();
<br>
if (size != list2.size())
<br>
{
<br>
return false;
<br>
}
<br>
<br>
for (int i = 0; i < size; i++)
<br>
{
<br>
EObject eObject1 = list1.get(i);
<br>
EObject eObject2 = list2.get(i);
<br>
if (!equals(eObject1, eObject2))
<br>
{
<br>
return false;
<br>
}
<br>
}
<br>
<br>
return true;
<br>
}
<br>
<br>
<br>
Is this a bug or did I misunderstood the meaning of the "ordered"
property ?
<br>
</blockquote>
Order is actually kind of useless because we've not implemented any
support for it:<a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=75931"><br>
</a>
<blockquote><a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=75931">https://bugs.eclipse.org/bugs/show_bug.cgi?id=75931</a><br>
</blockquote>
It's more of a vestigial remnant from MOF.<br>
</body>
</html>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02365 seconds