]> gerrit.simantics Code Review - simantics/interop.git/commitdiff
Path comparison does not use Resource Comparator. 29/4629/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Thu, 17 Dec 2020 08:49:11 +0000 (10:49 +0200)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Thu, 17 Dec 2020 08:49:11 +0000 (10:49 +0200)
gitlab #30

Change-Id: Ia27a64b42c2daafdcb888bca7dba546c4ca4ff06

org.simantics.interop/src/org/simantics/interop/test/GraphComparator.java

index 8ce5a9d66c0b4248a8c3b496bc8ce88e8a16cff3..a2724a523537f326104e418708d7d400d17e0c69 100644 (file)
@@ -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<Path> leftPaths, Set<Path> rightPaths) {
+       private boolean hasMatchingPaths(Set<Path> leftPaths, Set<Path> rightPaths) throws DatabaseException {
                if (leftPaths.size() != rightPaths.size())
                        return false;
                BijectionMap<Path,Path> map = getMatchingPaths(leftPaths, rightPaths);
                return map.size() == leftPaths.size();
        }
        
-       private BijectionMap<Path,Path> getMatchingPaths(Set<Path> leftPaths, Set<Path> rightPaths) {
+       private BijectionMap<Path,Path> getMatchingPaths(Set<Path> leftPaths, Set<Path> rightPaths) throws DatabaseException {
                BijectionMap<Path,Path> map = new BijectionMap<Path, Path>();
                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);