1 package org.simantics.interop.test;
3 import org.simantics.db.ReadGraph;
4 import org.simantics.db.Resource;
5 import org.simantics.db.exception.DatabaseException;
9 * @author Marko Luukkainen <marko.luukkainen@vtt.fi>
12 public abstract class ResourceComparator {
14 private GraphComparator comparator;
16 void setComparator(GraphComparator comparator) {
17 this.comparator = comparator;
20 public GraphComparator getComparator() {
25 * Optional initialization method for overriding implementations.
31 public void initialize(ReadGraph g, Resource r1, Resource r2) throws DatabaseException {
36 * Compares two resources and returns numeric value of differences, minimum value is 1.
39 * Integer.MAX_VALUE: Objects are not comparable.
40 * 0 (zero): Object comparison is not reliable.
42 * Result is same as compare(g, o1, o2, true);
45 public abstract int compare(ReadGraph g, Resource o1, Resource o2) throws DatabaseException;
48 * Compares two resources and returns numeric value of differences, minimum value is 1.
51 * Integer.MAX_VALUE: Objects are not comparable.
52 * 0 (zero): Object comparison is not reliable.
57 * @param local: if true, comparison must not utilise information stored into comparator.
59 * @throws DatabaseException
61 public abstract int compare(ReadGraph g, Resource o1, Resource o2, boolean local) throws DatabaseException;