}
private boolean attachCoveredRoots(DependencyStructure pdg, DependencyNode deepest) throws MaltChainedException {
int i;
boolean foundCoveredRoot = false;
DependencyNode coveredRootHead;
for (i = Math.min(deepest.getIndex(), deepest.getHead().getIndex()) + 1; i < Math.max(deepest.getIndex(), deepest.getHead()
.getIndex()); i++) {
int leftMostIndex = pdg.getDependencyNode(i).getLeftmostProperDescendantIndex();
if (leftMostIndex == -1) {
leftMostIndex = i;
}
int rightMostIndex = pdg.getDependencyNode(i).getRightmostProperDescendantIndex();
if (rightMostIndex == -1) {
rightMostIndex = i;
}
if (!nodeLifted.get(i) && pdg.getDependencyNode(i).getHead().isRoot() && !deepest.getHead().isRoot()
&& Math.min(deepest.getIndex(), deepest.getHead().getIndex()) < leftMostIndex
&& rightMostIndex < Math.max(deepest.getIndex(), deepest.getHead().getIndex())) {
if (rootAttachment == CoveredRootAttachment.LEFT) {
if (deepest.getHead().getIndex() < deepest.getIndex()) {
coveredRootHead = deepest.getHead();
} else {
coveredRootHead = deepest;
}
} else if (rootAttachment == CoveredRootAttachment.RIGHT) {
if (deepest.getIndex() < deepest.getHead().getIndex()) {
coveredRootHead = deepest.getHead();
} else {
coveredRootHead = deepest;
}
} else {
coveredRootHead = deepest.getHead();
}
pdg.moveDependencyEdge(coveredRootHead.getIndex(), pdg.getDependencyNode(i).getIndex());
setCoveredRoot(pdg.getDependencyNode(i));
foundCoveredRoot = true;
}
}
return foundCoveredRoot;