AncestorComparator acthis = new AncestorComparator(getTextNode(i)
.getParentTree());
AncestorComparator acother = new AncestorComparator(leftComparator
.getTextNode(j).getParentTree());
AncestorComparatorResult result = acthis.getResult(acother, locale);
if (result.isChanged()) {
Modification mod = new Modification(ModificationType.CHANGED,
ModificationType.CHANGED);
if (!changedIDUsed) {
mod.setFirstOfID(true);
if (nextLastModified.size() > 0) {
lastModified = nextLastModified;
nextLastModified = new ArrayList<Modification>();
}
} else if (result.getChanges() != null
&& !result.getChanges().equals(changes)) {
changedID++;
mod.setFirstOfID(true);
if (nextLastModified.size() > 0) {
lastModified = nextLastModified;
nextLastModified = new ArrayList<Modification>();
}
}
if (lastModified.size() > 0) {
mod.setPrevious(lastModified.get(0));
if (lastModified.get(0).getNext() == null) {
for (Modification lastMod : lastModified) {
lastMod.setNext(mod);
}
}
}
nextLastModified.add(mod);
mod.setChanges(result.getChanges());
mod.setHtmlLayoutChanges(result.getHtmlLayoutChanges());
mod.setID(changedID);
getTextNode(i).setModification(mod);
changes = result.getChanges();
changedIDUsed = true;
} else if (changedIDUsed) {
changedID++;
changedIDUsed = false;
}