From 0cb9829cf7fbee31bbc952c6313b01e195e8d010 Mon Sep 17 00:00:00 2001 From: Reino Ruusu Date: Tue, 19 May 2020 14:01:21 +0300 Subject: [PATCH] Fix change comparison expressions in mapping rules gitlab #534 Change-Id: Ib82f78be739e172b77c0499f034b8180ecc9e779 (cherry picked from commit ef0aeadaa15a3655c7f2a3b4377ad62b26e186e3) --- .../src/org/simantics/objmap/graph/rules/MappedElementRule.java | 2 +- .../org/simantics/objmap/graph/rules/MappedElementsRule.java | 2 +- .../src/org/simantics/objmap/graph/rules/ValueRule.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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 { -- 2.47.1