rs2.clear();
return false;
}
- if (rs1.size() == 0) {
- rs1.addAll(g.getObjects(r1, l0.Inherits));
- rs2.addAll(g.getObjects(r2, l0.Inherits));
- }
- if (rs1.size() == 0) {
- rs1.addAll(g.getObjects(r1, l0.SubrelationOf));
- rs2.addAll(g.getObjects(r2, l0.SubrelationOf));
- }
+
Comparator<Resource> rcomp = getComparator().getResourceComparator();
if (rs1.size() == 0) {
return rcomp.compare(r1, r2) == 0;
return true;
}
+ protected boolean compareInheritance(ReadGraph g, Resource r1, Resource r2) throws DatabaseException {
+ Layer0 l0 = Layer0.getInstance(g);
+
+ rs1.addAll(g.getObjects(r1, l0.Inherits));
+ rs2.addAll(g.getObjects(r2, l0.Inherits));
+
+ if (rs1.size() != rs2.size()) {
+ rs1.clear();
+ rs2.clear();
+ return false;
+ }
+ if (rs1.size() == 0) {
+ rs1.addAll(g.getObjects(r1, l0.SubrelationOf));
+ rs2.addAll(g.getObjects(r2, l0.SubrelationOf));
+ }
+ if (rs1.size() != rs2.size()) {
+ rs1.clear();
+ rs2.clear();
+ return false;
+ }
+ Comparator<Resource> rcomp = getComparator().getResourceComparator();
+ if (rs1.size() == 0) {
+ return rcomp.compare(r1, r2) == 0;
+ }
+
+ getComparator().sortResource(rs1, rs2);
+
+ for (int i = 0; i < rs1.size(); i++) {
+ int c = rcomp.compare(rs1.get(i), rs2.get(i));
+ if (c != 0) {
+ rs1.clear();
+ rs2.clear();
+ return false;
+ }
+ }
+
+ rs1.clear();
+ rs2.clear();
+
+ return true;
+ }
+
protected int propsDiffCount(ReadGraph g, Resource r1, Resource r2) throws DatabaseException {
Layer0 l0 = Layer0.getInstance(g);