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() {
26 * Compares two resources and returns numeric value of differences, minimum value is 1.
29 * Integer.MAX_VALUE: Objects are not comparable.
30 * 0 (zero): Object comparison is not reliable.
32 * Result is same as compare(g, o1, o2, true);
35 public abstract int compare(ReadGraph g, Resource o1, Resource o2) throws DatabaseException;
38 * Compares two resources and returns numeric value of differences, minimum value is 1.
41 * Integer.MAX_VALUE: Objects are not comparable.
42 * 0 (zero): Object comparison is not reliable.
47 * @param local: if true, comparison must not utilise information stored into comparator.
49 * @throws DatabaseException
51 public abstract int compare(ReadGraph g, Resource o1, Resource o2, boolean local) throws DatabaseException;