Eclipse Community Forums Forum Search:

Home » Modeling » Compare » [EMF Compare] Conflict of Indexes/order(Conflict of Indexes/order)
[EMF Compare] Conflict of Indexes/order Fri, 15 February 2019 21:31
 Alfa YohannisMessages: 9Registered: April 2018 Junior Member
Hi Everyone,

Let's say that there are there models, original, left, and right models.
In the original model, there is a containment reference 'X' that contains elements a, b, and c. In the left model, the order of these elements has changed to b, a, c. While, in the right model, the order is a, c, b.

Is this condition a conflict? Since the indexes of b are different in every model (or the members of 'X' are different in their order in every model).

I already tried this using EMF Compare, and the result was there was no conflict, just differences. How come?

Cheers
Re: [EMF Compare] Conflict of Indexes/order [message #1802852 is a reply to message #1802790] Mon, 18 February 2019 08:54
 Laurent GoubetMessages: 1895Registered: July 2009 Senior Member
Hello,

This is not a conflict because of the way EMF Compare determines the differences. We go for the "minimal" number of differences in the model, and this means that what we use to determine ordering is the Longest Common Subsequence (LCS) between the elements.

In order to go from origin to left:
origin A B C
left B A C

There are two subsequences of the same length : AC and BC. In such cases, the arbitrary choice from EMF Compare is to use the first LCS from the second list, which is "BC", we thus determine that the change in the left model is "A has been moved".

In order to go from origin to right:
origin A B C
right A C B

There are again two subsequences of the same length : AC and AB. Once again, we use the first from the second list, which is "AC". The difference between the two models is then "B has been moved".

"A has been moved" is not in conflict with "B has been moved", so you get two differences with no conflict.

origin A B C D
left A C B D
right A C D B

then you will see a conflict, since in both cases the element determined to be moved is "B".

Laurent Goubet
Obeo
Re: [EMF Compare] Conflict of Indexes/order [message #1802893 is a reply to message #1802852] Mon, 18 February 2019 15:19
 Alfa YohannisMessages: 9Registered: April 2018 Junior Member
Hi Laurent,

I see, now. So, EMF compare' makes its decision based on the LCS algorithm.
I was just wondering because B is implicitly moved from index 1 to 0 when we move A from index 0 to 1 in the first origin-left example, which also similarly applies to the first origin-right example.
But, it's all based on its LCS algorithm.

Thanks for the enlightenment :)

 Previous Topic: EMFCompare filtering files out of model resolving phase Next Topic: EMF Compare and Merge (Object)
Goto Forum:

Current Time: Sun Sep 26 07:34:01 GMT 2021