X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.interop.update%2Fsrc%2Forg%2Fsimantics%2Finterop%2Fupdate%2Fmodel%2FPropertyChange.java;fp=org.simantics.interop.update%2Fsrc%2Forg%2Fsimantics%2Finterop%2Fupdate%2Fmodel%2FPropertyChange.java;h=75d8456140d77f82709f61381fea218e4e086af2;hb=328e8a54d282ed4a390e6eb9eda027b3ed599bdf;hp=69256b0381ed7549ed4f4484734b6ddbbf306fc6;hpb=237d8b627738ed212599f77aea944bec20fd3497;p=simantics%2Finterop.git diff --git a/org.simantics.interop.update/src/org/simantics/interop/update/model/PropertyChange.java b/org.simantics.interop.update/src/org/simantics/interop/update/model/PropertyChange.java index 69256b0..75d8456 100644 --- a/org.simantics.interop.update/src/org/simantics/interop/update/model/PropertyChange.java +++ b/org.simantics.interop.update/src/org/simantics/interop/update/model/PropertyChange.java @@ -9,30 +9,49 @@ import org.simantics.utils.datastructures.Pair; public class PropertyChange { protected GraphChanges changes; + protected Resource leftSubject; + protected Resource rightSubject; protected Pair pair; protected boolean applied = false; protected boolean selected = false; protected boolean visible = true; - public PropertyChange(GraphChanges changes, Statement first, Statement second) { + public PropertyChange(GraphChanges changes, Resource left, Statement first, Resource right, Statement second) { if (first == null && second == null) throw new IllegalArgumentException("At least one of the stamenents must be non null."); + if (left == null || right == null) + throw new IllegalArgumentException("Subject resources cannot be null."); this.pair = new Pair(first, second); this.changes = changes; + this.leftSubject = left; + this.rightSubject = right; } - public PropertyChange(GraphChanges changes, Pair change) { + public PropertyChange(GraphChanges changes, Resource left, Resource right, Pair change) { if (change == null || (change.first == null && change.second == null)) throw new IllegalArgumentException("At least one of the stamenents must be non null."); + if (left == null || right == null) + throw new IllegalArgumentException("Subject resources cannot be null."); this.pair = change; this.changes = changes; + this.leftSubject = left; + this.rightSubject = right; + } + + + public Resource getFirstSubject() { + return leftSubject; } public Statement getFirst() { return pair.first; } + public Resource getSecondSubject() { + return rightSubject; + } + public Statement getSecond() { return pair.second; } @@ -60,10 +79,11 @@ public class PropertyChange { if (applied) return; if (pair.second == null) { - graph.deny(pair.first); + graph.deny(leftSubject, pair.first.getPredicate(),pair.first.getObject()); return; } - Resource s = changes.getComparable().getLeft(pair.second.getSubject()); + Resource s = leftSubject; + //Resource s = changes.getComparable().getLeft(rightSubject); //Resource s = pair.first.getSubject(); Resource pred = pair.second.getPredicate(); if (graph.hasValue(pair.second.getObject())) { @@ -104,9 +124,9 @@ public class PropertyChange { public String toString() { String s = "PropertyChange"; if (pair.first != null) - s += " (" + (pair.first.getSubject()) + " , " + pair.first.getPredicate() + " , " + pair.first.getObject() + ")"; + s += " (" + (leftSubject) + " , " + pair.first.getPredicate() + " , " + pair.first.getObject() + ")"; if (pair.second != null) - s += " (" + (pair.second.getSubject()) + " , " + pair.second.getPredicate() + " , " + pair.second.getObject() + ")"; + s += " (" + (rightSubject) + " , " + pair.second.getPredicate() + " , " + pair.second.getObject() + ")"; return s; }