code: public static void setParents(final Parse p) {
      final Parse[] children = p.getChildren();
      for (final Parse element : children) {
        element.setParent(p);
        setParents(element);
      }
    }
docs: Assigns parent references for the specified parse so that they are
  consistent with the children references.
  
  @param p
  The parse whose parent references need to be assigned.