]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Fix change comparison expressions in mapping rules 44/4244/1
authorReino Ruusu <reino.ruusu@semantum.fi>
Tue, 19 May 2020 11:01:21 +0000 (14:01 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 19 May 2020 11:17:16 +0000 (11:17 +0000)
gitlab #534

Change-Id: Ib82f78be739e172b77c0499f034b8180ecc9e779
(cherry picked from commit ef0aeadaa15a3655c7f2a3b4377ad62b26e186e3)

bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementRule.java
bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementsRule.java
bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/ValueRule.java

index a0b7befed3951850a64c7816ad0902f13ca75058..251895ad72a1aedc7aac9966b5f51b5bc83aa08b 100644 (file)
@@ -67,7 +67,7 @@ public class MappedElementRule<Domain, Range> implements IBidirectionalMappingRu
        public boolean checkChanges(ReadGraph g, IForwardMapping<Domain, Range> map, Domain domainElement, Range rangeElement) throws MappingException {
            Domain value = domainAccessor.get(g, domainElement);
            Range mappedValue = value == null ? null : map.map(g, value);
-           return mappedValue == rangeAccessor.get(rangeElement);
+           return mappedValue != rangeAccessor.get(rangeElement);
        }
        
     @Override
index 45fe7064111ad017022d9a8d90caedba7e01694f..fcc62d7b5444e925ad451124eb14bd67c9b02caf 100644 (file)
@@ -75,7 +75,7 @@ public class MappedElementsRule<Domain, Range> implements IBidirectionalMappingR
     public boolean checkChanges(ReadGraph g, IForwardMapping<Domain, Range> map, Domain domainElement, Range rangeElement) throws MappingException {
         LOGGER.trace("    MappedElementsRule.updateRange");
         ArrayList<Range> mappedValue = getMappedValue(g, map, domainElement);
-        return Objects.equals(mappedValue, rangeAccessor.get(rangeElement));
+        return !Objects.equals(mappedValue, rangeAccessor.get(rangeElement));
     }
 
        private ArrayList<Range> getMappedValue(ReadGraph g, IForwardMapping<Domain, Range> map, Domain domainElement)
index cbea3253a9135fd403d81c016eacd2cae8ad2377..2e2b81b191abe792826df445f55e548357df888c 100644 (file)
@@ -66,7 +66,7 @@ public class ValueRule<Domain, Range> implements IBidirectionalMappingRule<Domai
        public boolean checkChanges(ReadGraph g, IForwardMapping<Domain, Range> map, Domain domainElement,
                        Range rangeElement) throws MappingException {
                Object value = rangeAccessor.get(rangeElement);
-               return Objects.equals(value, domainAccessor.get(g, domainElement));
+               return !Objects.equals(value, domainAccessor.get(g, domainElement));
        }
        
        public void createDomain(WriteGraph g, IBackwardMapping<Domain,Range> map, Domain domainElement, Range rangeElement) throws MappingException {