Skip to content

Commit 15b616c

Browse files
committed
Remove duplicate code
1 parent fea996b commit 15b616c

1 file changed

Lines changed: 1 addition & 29 deletions

File tree

  • src/main/java/org/variantsync/diffdetective/variation/diff

src/main/java/org/variantsync/diffdetective/variation/diff/DiffTree.java

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -454,35 +454,7 @@ public ConsistencyResult isConsistent() {
454454
}
455455

456456
public boolean isSameAs(DiffTree b) {
457-
var visited = new HashSet<DiffNode>();
458-
return isSameAs(this.getRoot(), b.getRoot(), visited);
459-
}
460-
461-
private static boolean isSameAs(DiffNode a, DiffNode b, Set<DiffNode> visited) {
462-
if (!visited.add(a)) {
463-
return true;
464-
}
465-
466-
if (!(
467-
a.getDiffType().equals(b.getDiffType()) &&
468-
a.getNodeType().equals(b.getNodeType()) &&
469-
a.getFromLine().equals(b.getFromLine()) &&
470-
a.getToLine().equals(b.getToLine()) &&
471-
(a.getFormula() == null ? b.getFormula() == null : a.getFormula().equals(b.getFormula())) &&
472-
a.getLabel().equals(b.getLabel())
473-
)) {
474-
return false;
475-
}
476-
477-
Iterator<DiffNode> aIt = a.getAllChildren().iterator();
478-
Iterator<DiffNode> bIt = b.getAllChildren().iterator();
479-
while (aIt.hasNext() && bIt.hasNext()) {
480-
if (!isSameAs(aIt.next(), bIt.next(), visited)) {
481-
return false;
482-
}
483-
}
484-
485-
return aIt.hasNext() == bIt.hasNext();
457+
return getRoot().isSameAs(b.getRoot());
486458
}
487459

488460
@Override

0 commit comments

Comments
 (0)