From: Reino Ruusu Date: Tue, 19 May 2020 11:01:21 +0000 (+0300) Subject: Fix change comparison expressions in mapping rules X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=0cb9829cf7fbee31bbc952c6313b01e195e8d010;p=simantics%2Fplatform.git Fix change comparison expressions in mapping rules gitlab #534 Change-Id: Ib82f78be739e172b77c0499f034b8180ecc9e779 (cherry picked from commit ef0aeadaa15a3655c7f2a3b4377ad62b26e186e3) --- diff --git a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementRule.java b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementRule.java index a0b7befed..251895ad7 100644 --- a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementRule.java +++ b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementRule.java @@ -67,7 +67,7 @@ public class MappedElementRule implements IBidirectionalMappingRu public boolean checkChanges(ReadGraph g, IForwardMapping 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 diff --git a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementsRule.java b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementsRule.java index 45fe70641..fcc62d7b5 100644 --- a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementsRule.java +++ b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementsRule.java @@ -75,7 +75,7 @@ public class MappedElementsRule implements IBidirectionalMappingR public boolean checkChanges(ReadGraph g, IForwardMapping map, Domain domainElement, Range rangeElement) throws MappingException { LOGGER.trace(" MappedElementsRule.updateRange"); ArrayList mappedValue = getMappedValue(g, map, domainElement); - return Objects.equals(mappedValue, rangeAccessor.get(rangeElement)); + return !Objects.equals(mappedValue, rangeAccessor.get(rangeElement)); } private ArrayList getMappedValue(ReadGraph g, IForwardMapping map, Domain domainElement) diff --git a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/ValueRule.java b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/ValueRule.java index cbea3253a..2e2b81b19 100644 --- a/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/ValueRule.java +++ b/bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/ValueRule.java @@ -66,7 +66,7 @@ public class ValueRule implements IBidirectionalMappingRule 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 map, Domain domainElement, Range rangeElement) throws MappingException {