1 package org.simantics.graph.diff;
3 public class Statement {
9 public Statement(int subject, int predicate, int inverse, int object) {
10 this.subject = subject;
11 this.predicate = predicate;
12 this.inverse = inverse;
17 public int hashCode() {
20 result = prime * result + inverse;
21 result = prime * result + object;
22 result = prime * result + predicate;
23 result = prime * result + subject;
28 public boolean equals(Object obj) {
33 if (getClass() != obj.getClass())
35 Statement other = (Statement) obj;
36 if (inverse != other.inverse)
38 if (object != other.object)
40 if (predicate != other.predicate)
42 if (subject != other.subject)
47 public Statement map(int[] map) {
48 int mappedSubject = map[subject];
49 if(mappedSubject < 0) return null;
50 int mappedPredicate = map[predicate];
51 if(mappedPredicate < 0) return null;
54 mappedInverse = inverse;
56 mappedInverse = map[inverse];
57 if(mappedInverse < 0) return null;
59 int mappedObject = map[object];
60 if(mappedObject < 0) return null;
61 return new Statement(mappedSubject, mappedPredicate, mappedInverse, mappedObject);