if (next == root)
if (next == root.getParentNode())
  private Node successor(Node here, boolean forward)  {    Node next;    // the "leftmost" end is funky    if (here == null)      {        return forward ? root : null;      }    //    // Forward, this is preorder: children before siblings.    // Backward, it's postorder: we saw the children already.    //    if (forward && !isLeaf(here))      {        return here.getFirstChild();      }    //    // Siblings ... if forward, we visit them, if backwards    // we visit their children first.    //    if (forward)      {        if ((next = here.getNextSibling()) != null)          {            return next;          }      }    else if ((next = here.getPreviousSibling()) != null)      {        if (isLeaf(next))          {            return next;          }        next = next.getLastChild();        while (!isLeaf(next))          {            next = next.getLastChild();          }        return next;      }	    //    // We can't go down or lateral -- it's up, then.  The logic is    // the converse of what's above:  backwards is easy (the parent    // is next), forwards isn't.    //    next = here.getParentNode();    if (!forward)      {        return next;      }        Node temp = null;    while (next != null           && next != root           && (temp = next.getNextSibling()) == null)      {        next = next.getParentNode();      }    if (next == root)      {        return null;      }    return temp;  }