use of org.neo4j.internal.schema.constraints.IndexBackedConstraintDescriptor in project neo4j by neo4j.
the class RandomSchema method schemaDeepEquals.
public static boolean schemaDeepEquals(SchemaRule a, SchemaRule b) {
if (!a.equals(b)) {
return false;
}
if (a.getId() != b.getId()) {
return false;
}
if (!a.getName().equals(b.getName())) {
return false;
}
if (a.getClass() != b.getClass()) {
return false;
}
if (a instanceof IndexDescriptor) {
IndexDescriptor indexA = (IndexDescriptor) a;
IndexDescriptor indexB = (IndexDescriptor) b;
return indexA.getCapability().equals(indexB.getCapability()) && indexA.isUnique() == indexB.isUnique() && indexA.getIndexProvider().equals(indexB.getIndexProvider()) && indexA.getIndexType() == indexB.getIndexType() && indexA.getOwningConstraintId().equals(indexB.getOwningConstraintId()) && schemaDeepEquals(indexA.schema(), indexB.schema());
} else {
ConstraintDescriptor constraintA = (ConstraintDescriptor) a;
ConstraintDescriptor constraintB = (ConstraintDescriptor) b;
if (constraintA.isIndexBackedConstraint() && constraintB.isIndexBackedConstraint()) {
IndexBackedConstraintDescriptor ibcA = constraintA.asIndexBackedConstraint();
IndexBackedConstraintDescriptor ibcB = constraintB.asIndexBackedConstraint();
return ibcA.hasOwnedIndexId() == ibcB.hasOwnedIndexId() && (!ibcA.hasOwnedIndexId() || ibcA.ownedIndexId() == ibcB.ownedIndexId()) && ibcA.equals(ibcB) && schemaDeepEquals(ibcA.schema(), ibcB.schema());
} else {
return constraintA.isIndexBackedConstraint() == constraintB.isIndexBackedConstraint() && constraintA.equals(constraintB) && schemaDeepEquals(constraintA.schema(), constraintB.schema());
}
}
}
Aggregations