]> gerrit.simantics Code Review - simantics/interop.git/commitdiff
Allow type comparator to compare types, not just instances. 96/4896/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Wed, 23 Feb 2022 15:05:04 +0000 (17:05 +0200)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Wed, 23 Feb 2022 15:05:04 +0000 (17:05 +0200)
gitlab #36

Change-Id: If876dffa426445e271355e92be54f6270941bfe6

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

index a2a37226cbaf9dd538d7c4fef5873b25dfcdc5f2..6a05562961d230551220f10deb913b97fbd3528e 100644 (file)
@@ -59,6 +59,14 @@ public class TypeComparator extends ResourceComparator {
                        rs2.clear();
                        return false;
                }
+               if (rs1.size() == 0) {
+                       rs1.addAll(g.getObjects(r1, l0.Inherits));
+                       rs2.addAll(g.getObjects(r2, l0.Inherits));
+               }
+               if (rs1.size() == 0) {
+                       rs1.addAll(g.getObjects(r1, l0.SubrelationOf));
+                       rs2.addAll(g.getObjects(r2, l0.SubrelationOf));
+               }
                Comparator<Resource> rcomp = getComparator().getResourceComparator();
                if (rs1.size() == 0) {
                        return rcomp.compare(r1, r2) == 0;