+ public static class Modification {
+ Resource leftSub;
+ Resource rightSub;
+ Statement leftStm;
+ Statement rightStm;
+
+
+ int hashCode;
+
+ public Modification(Resource leftSub, Resource rightSub, Statement leftStm, Statement rightStm) {
+ super();
+ this.leftSub = leftSub;
+ this.rightSub = rightSub;
+ this.leftStm = leftStm;
+ this.rightStm = rightStm;
+
+ hashCode = leftSub.hashCode() + rightSub.hashCode();
+ if (leftStm != null)
+ hashCode += leftStm.hashCode();
+ if (rightStm != null)
+ hashCode += rightStm.hashCode();
+ }
+
+ public boolean isLeftAsserted() {
+ return !leftSub.equals(leftStm.getSubject());
+ }
+
+ public boolean isRightAsserted() {
+ return !rightSub.equals(rightStm.getSubject());
+ }
+
+ public Resource getLeftSub() {
+ return leftSub;
+ }
+
+ public void setLeftSub(Resource leftSub) {
+ this.leftSub = leftSub;
+ }
+
+ public Resource getRightSub() {
+ return rightSub;
+ }
+
+ public void setRightSub(Resource rightSub) {
+ this.rightSub = rightSub;
+ }
+
+ public Statement getLeftStm() {
+ return leftStm;
+ }
+
+ public void setLeftStm(Statement leftStm) {
+ this.leftStm = leftStm;
+ }
+
+ public Statement getRightStm() {
+ return rightStm;
+ }
+
+ public void setRightStm(Statement rightStm) {
+ this.rightStm = rightStm;
+ }
+
+ public Resource getPredicate() {
+ if (leftStm != null)
+ return leftStm.getPredicate();
+ return rightStm.getPredicate();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj.getClass() != this.getClass())
+ return false;
+ Modification other = (Modification)obj;
+ if (!leftSub.equals(other.leftSub))
+ return false;
+ if (!rightSub.equals(other.rightSub))
+ return false;
+ if (leftStm != null) {
+ if (!leftStm.equals(other.leftStm))
+ return false;
+ } else if (other.leftStm != null)
+ return false;
+ if (rightStm != null) {
+ if (!rightStm.equals(other.rightStm))
+ return false;
+ } else if (other.rightStm != null)
+ return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return hashCode;
+ }
+
+ }
+