@Override
protected int searchAndProcessObjectSimilarTo(DBIndex originalIndex, List<DBIndex> candidates, CompositeStructuralChange<?> ownerChange) {
String[] searchedColumnNames = originalIndex.getColumnNames();
for (int i = 0; i < candidates.size(); i++) {
DBIndex candidate = candidates.get(i);
String[] candidateColumnNames = candidate.getColumnNames();
if (Arrays.equals(searchedColumnNames, candidateColumnNames)) {
processRenamed(originalIndex, candidate, ownerChange);
return i;
}
}
for (int i = 0; i < candidates.size(); i++) {
DBIndex candidate = candidates.get(i);
String[] candidateColumnNames = candidate.getColumnNames();
if (ArrayUtil.equalsIgnoreOrder(searchedColumnNames, candidateColumnNames)) {
processRenamed(originalIndex, candidate, ownerChange);
if (!originalIndex.isNameDeterministic() || !candidate.isNameDeterministic())
ownerChange.addSubChange(new Rename<DBIndex>(originalIndex, candidate.getName()));
return i;
}
}
return -1;
}