]> gerrit.simantics Code Review - simantics/interop.git/blob - org.simantics.interop/src/org/simantics/interop/test/ResourceComparator.java
f65617cb1dac8fe22e76a95173f5616d6ec54c9e
[simantics/interop.git] / org.simantics.interop / src / org / simantics / interop / test / ResourceComparator.java
1 package org.simantics.interop.test;
2
3 import org.simantics.db.ReadGraph;
4 import org.simantics.db.Resource;
5 import org.simantics.db.exception.DatabaseException;
6
7 /**
8  * 
9  * @author Marko Luukkainen <marko.luukkainen@vtt.fi>
10  *
11  */
12 public abstract class ResourceComparator {
13         
14         private GraphComparator comparator;
15         
16         void setComparator(GraphComparator comparator) {
17                 this.comparator = comparator;
18         }
19         
20         public GraphComparator getComparator() {
21                 return comparator;
22         }
23         
24         
25         /**
26          * Compares two resources and returns numeric value of differences, minimum value is 1. 
27          * 
28          * Special values:
29          * Integer.MAX_VALUE: Objects are not comparable.
30          * 0 (zero): Object comparison is not reliable. 
31          * 
32          * Result is same as compare(g, o1, o2, true);
33          * 
34          */
35         public abstract int compare(ReadGraph g, Resource o1, Resource o2) throws DatabaseException;
36         
37         /**
38          * Compares two resources and returns numeric value of differences, minimum value is 1. 
39          * 
40          * Special values:
41          * Integer.MAX_VALUE: Objects are not comparable.
42          * 0 (zero): Object comparison is not reliable. 
43          * 
44          * @param g
45          * @param o1
46          * @param o2
47          * @param local: if true, comparison must not utilise information stored into comparator. 
48          * @return
49          * @throws DatabaseException
50          */
51         public abstract int compare(ReadGraph g, Resource o1, Resource o2, boolean local) throws DatabaseException;
52
53 }