code: public Parse getCommonParent(Parse node) {
      if (this == node) {
        return parent;
      }
      Set parents = new HashSet();
      Parse cparent = this;
      while(cparent != null) {
        parents.add(cparent);
        cparent = cparent.getParent();
      }
      while (node != null) {
        if (parents.contains(node)) {
          return node;
        }
        node = node.getParent();
      }
      return null;
    }
docs: Returns the deepest shared parent of this node and the specified node.
  If the nodes are identical then their parent is returned.
  If one node is the parent of the other then the parent node is returned.
  @param node The node from which parents are compared to this node's parents.
  @return the deepest shared parent of this node and the specified node.