} else {
int location1 = getLocation(currentNode, pos1, false);
int location2 = getLocation(currentNode, pos2, false);
if (location1 < IN_MIDDLE && location2 > IN_MIDDLE) {
// TODO: push the node into result.--
result.push(new WorkNode(currentNode, pos1, pos2));
} else if (location1 <= IN_MIDDLE && location2 >= IN_MIDDLE) {
if (currentNode.hasChildNodes()) {
Node child = currentNode.getFirstChild();
Stack myResult = new Stack();
while (child != null) {
collectNodes(child, pos1, pos2, top, myResult);
child = child.getNextSibling();
}
if (location1 < IN_MIDDLE && location2 >= IN_MIDDLE
|| location1 <= IN_MIDDLE && location2 > IN_MIDDLE) {
WorkNode workNode = new WorkNode(currentNode, pos1,
pos2);
while (myResult.size() > 0) {
WorkNode w = (WorkNode) myResult.remove(0);
if (w.getNode().getParentNode() == workNode
.getNode()) {
w.setParent(workNode);
}
result.push(w);
}
// TODO: push parent into result.--
result.push(workNode);
}
} else {
if (!(location1 == IN_MIDDLE && location2 == IN_MIDDLE)) {
// TODO: push this node into result.
result.push(new WorkNode(currentNode, pos1, pos2));
}
}
}
}
}