[EMF Compare] Questions on the implemention of custom IMatchEngines [message #1324262] |
Wed, 30 April 2014 17:54 |
Andreas Mayer Messages: 11 Registered: April 2014 |
Junior Member |
|
|
Hi,
I've implemented a custom IMatchEngine for my model. It's basically
working, but I still have some questions that I couldn't answer by
reading the documentation [1] or browsing the code:
* How are you supposed to implement
IMatchEngine.Factory.isMatchEngineFactoryFor(IComparisonScope)?
When this method is called in my factory (run by "Compare With > Each
Other" in the IDE), both IComparisonScope.getNsURIs() and
IComparisonScope.getResourceURIs() return an empty set. So my
implementation iterates over the contents of left, right, and origin to
see if there is any object from my model package. The default
implementations all just return true. Is there a better way?
* As far as I can see, an IMatchEngine should structure the detected
matches to resemble the structure of the input models. Is this also true
for non-matches?
ProximityEObjectMatcher always restructures matches in a final step,
whereas IdentifierEObjectMatcher adds non-matches as roots [2] if there
is no delegate matcher.
* Since all IEObjectMatchers are required to create this match
hierarchy, shouldn't it rather be done as some kind of post-processing
in DefaultMatchEngine. Especially when considered that IEObjectMatchers
can be chained as done in IdentifierEObjectMatcher.
* The current implementation of IdentifierEObjectMatcher is
unnecessarily restricted to ids of type string, but could also work with
ids of any type. Then you could also use composite keys such as
Arrays.asList(object.getType(), object.getName(), object.getRevision())
to match objects. I basically cloned the code and only changed the id
type to achieve this.
[1]
<http://www.eclipse.org/emf/compare/documentation/latest/developer/developer-guide.html>
[2] Actually, the implementation of IdentifierEObjectMatcher is
incorrect here, since the matches are only added to a temporary set and
never to the given comparison.
Thanks,
Andreas
|
|
|
Powered by
FUDForum. Page generated in 0.03174 seconds