Compare nodes with different parent hierarchy [message #1695786] |
Tue, 19 May 2015 05:32  |
Eclipse User |
|
|
|
Hi,
I try to compare two nodes where one node is additionally contained in another node.
Apart from this the two nodes and their sub-trees are equal and I expect to get no differences.
The reason seems to be the IEqualityHelper in the EditionDistance where the URI-distance is used.
Here is some sample code:
Document document1 = createDocument();
Document document2 = createDocument();
Project project = ModelFactory.eINSTANCE.createProject();
project.getDocuments.add(document1);
IEObjectMatcher matcher = DefaultMatchEngine.createDefaultEObjectMatcher(UseIdentifiers.NEVER);
IComparisonFactory comparisonFactory = new DefaultComparisonFactory(new DefaultEqualityHelperFactory());
IMatchEngine.Factory matchEngineFactory = new MatchEngineFactoryImpl(matcher, comparisonFactory);
matchEngineFactory.setRanking(20);
IMatchEngine.Factory.Registry matchEngineRegistry = new MatchEngineFactoryRegistryImpl();
matchEngineRegistry.add(matchEngineFactory);
EMFCompare comparator = EMFCompare.builder().setMatchEngineFactoryRegistry(matchEngineRegistry).build();
IComparisonScope scope = new DefaultComparisonScope(document1, document2, null);
Comparison result = comparator.compare(scope);
List<Diff> diffs = result.getDifferences();
assertEquals(0, diffs.size()); // Fails
Maybe I've missed something. Is there a setting to ignore the parent nodes?
Regards,
Kai
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03912 seconds