From 20e678dfd8009455c2643a978802e9d0dfa6ce3b Mon Sep 17 00:00:00 2001 From: Marko Luukkainen Date: Thu, 17 Dec 2020 10:49:11 +0200 Subject: [PATCH] Path comparison does not use Resource Comparator. gitlab #30 Change-Id: Ia27a64b42c2daafdcb888bca7dba546c4ca4ff06 --- .../org/simantics/interop/test/GraphComparator.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/org.simantics.interop/src/org/simantics/interop/test/GraphComparator.java b/org.simantics.interop/src/org/simantics/interop/test/GraphComparator.java index 8ce5a9d..a2724a5 100644 --- a/org.simantics.interop/src/org/simantics/interop/test/GraphComparator.java +++ b/org.simantics.interop/src/org/simantics/interop/test/GraphComparator.java @@ -455,7 +455,7 @@ public class GraphComparator { // compare objects (unreliable result is interpreted as positive match) int comp = comparator.compare(g, left.get(i).getObject(), similarLeft.get(j).getObject(), true); - if (comp >= 0 && comp < Integer.MAX_VALUE) { + if (comp >= 0 && comp < ResourceComparator.NO_MATCH) { useL[i] = true; useSL[j] = true; break; @@ -695,14 +695,14 @@ public class GraphComparator { } - private boolean hasMatchingPaths(Set leftPaths, Set rightPaths) { + private boolean hasMatchingPaths(Set leftPaths, Set rightPaths) throws DatabaseException { if (leftPaths.size() != rightPaths.size()) return false; BijectionMap map = getMatchingPaths(leftPaths, rightPaths); return map.size() == leftPaths.size(); } - private BijectionMap getMatchingPaths(Set leftPaths, Set rightPaths) { + private BijectionMap getMatchingPaths(Set leftPaths, Set rightPaths) throws DatabaseException { BijectionMap map = new BijectionMap(); for (Path leftPath : leftPaths) { for (Path rightPath : rightPaths) { @@ -723,6 +723,10 @@ public class GraphComparator { match = false; break; } + if (comparator.compare(g, sl.getObject(), sr.getObject()) == ResourceComparator.NO_MATCH) { + match = false; + break; + } } if (match) { map.map(leftPath, rightPath); -- 2.45.1