@Override public DirectoryEntry copy() { DirectoryEntry result = copyEntry(); for (Entry child : myChildren) { result.unsafeAddChild(child.copy()); } return result; }
@Override public void collectDifferencesWith(Entry right, List<Difference> result) { DirectoryEntry e = (DirectoryEntry) right; if (!getPath().equals(e.getPath())) { result.add(new Difference(false, this, e)); } addCreatedChildrenDifferences(e, result); addDeletedChildrenDifferences(e, result); addModifiedChildrenDifferences(e, result); }
private void addDeletedChildrenDifferences(DirectoryEntry e, List<Difference> result) { for (Entry child : myChildren) { if (e.findDirectChild(child.getId()) == null) { child.collectDeletedDifferences(result); } } }
private void addModifiedChildrenDifferences(DirectoryEntry e, List<Difference> result) { for (Entry myChild : myChildren) { Entry itsChild = e.findDirectChild(myChild.getId()); if (itsChild != null) { myChild.collectDifferencesWith(itsChild, result); } } }