public boolean deleteByIndex(int index)
{
Node curNode = head;
while (curNode.getDown() != null)
curNode = curNode.getDown();
for (int i=0; i<index ; i++)
curNode = curNode.getRight();
if (curNode == null)
return false;
while (curNode != null)
{
if (curNode.getRight() != null)
{
curNode.getLeft().setRight(curNode.getRight());
curNode.getRight().setLeft(curNode.getLeft());
}
else
{
curNode.getLeft().setRight(null);
}
curNode = curNode.getUp();
}
return true;
}