public class PropertyChange {
protected GraphChanges changes;
+ protected Resource leftSubject;
+ protected Resource rightSubject;
protected Pair<Statement, Statement> 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<Statement, Statement>(first, second);
this.changes = changes;
+ this.leftSubject = left;
+ this.rightSubject = right;
}
- public PropertyChange(GraphChanges changes, Pair<Statement, Statement> change) {
+ public PropertyChange(GraphChanges changes, Resource left, Resource right, Pair<Statement, Statement> 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;
}
+ public Resource getPredicate() {
+ if (pair.first != null)
+ return pair.first.getPredicate();
+ return pair.second.getPredicate();
+ }
+
public GraphChanges getChanges() {
return changes;
}
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())) {
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;
}