X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.graph%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fdiff%2FStatement.java;h=dd8ce0304a26c2d2ccbdfcac98908a7f7b3f7db7;hb=refs%2Fchanges%2F38%2F238%2F2;hp=a15e0bb927f4c1c2caaa115d8d17c40a383513af;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.graph/src/org/simantics/graph/diff/Statement.java b/bundles/org.simantics.graph/src/org/simantics/graph/diff/Statement.java index a15e0bb92..dd8ce0304 100644 --- a/bundles/org.simantics.graph/src/org/simantics/graph/diff/Statement.java +++ b/bundles/org.simantics.graph/src/org/simantics/graph/diff/Statement.java @@ -1,63 +1,63 @@ -package org.simantics.graph.diff; - -public class Statement { - int subject; - int predicate; - int inverse; - int object; - - public Statement(int subject, int predicate, int inverse, int object) { - this.subject = subject; - this.predicate = predicate; - this.inverse = inverse; - this.object = object; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + inverse; - result = prime * result + object; - result = prime * result + predicate; - result = prime * result + subject; - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Statement other = (Statement) obj; - if (inverse != other.inverse) - return false; - if (object != other.object) - return false; - if (predicate != other.predicate) - return false; - if (subject != other.subject) - return false; - return true; - } - - public Statement map(int[] map) { - int mappedSubject = map[subject]; - if(mappedSubject < 0) return null; - int mappedPredicate = map[predicate]; - if(mappedPredicate < 0) return null; - int mappedInverse; - if(inverse < 0) - mappedInverse = inverse; - else { - mappedInverse = map[inverse]; - if(mappedInverse < 0) return null; - } - int mappedObject = map[object]; - if(mappedObject < 0) return null; - return new Statement(mappedSubject, mappedPredicate, mappedInverse, mappedObject); - } -} +package org.simantics.graph.diff; + +public class Statement { + int subject; + int predicate; + int inverse; + int object; + + public Statement(int subject, int predicate, int inverse, int object) { + this.subject = subject; + this.predicate = predicate; + this.inverse = inverse; + this.object = object; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + inverse; + result = prime * result + object; + result = prime * result + predicate; + result = prime * result + subject; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Statement other = (Statement) obj; + if (inverse != other.inverse) + return false; + if (object != other.object) + return false; + if (predicate != other.predicate) + return false; + if (subject != other.subject) + return false; + return true; + } + + public Statement map(int[] map) { + int mappedSubject = map[subject]; + if(mappedSubject < 0) return null; + int mappedPredicate = map[predicate]; + if(mappedPredicate < 0) return null; + int mappedInverse; + if(inverse < 0) + mappedInverse = inverse; + else { + mappedInverse = map[inverse]; + if(mappedInverse < 0) return null; + } + int mappedObject = map[object]; + if(mappedObject < 0) return null; + return new Statement(mappedSubject, mappedPredicate, mappedInverse, mappedObject); + } +}