code: public void insertAsParent( PlanNode newParent ) {
          if (newParent == null) return;
          newParent.removeFromParent();
          if (this.parent != null) {
              this.parent.replaceChild(this, newParent);
          }
          newParent.addLastChild(this);
      }
docs: Insert the supplied node into the plan node tree immediately above this node. If this node has a parent when this method is
  called, the new parent essentially takes the place of this node within the list of children of the old parent. This method
  does nothing if the supplied new parent is null.
  <p>
  For example, consider a plan node tree before this method is called:
  
  <pre>
  A
  / | \
  /  |  \
  B   C   D
  </pre>
  
  Then after this method is called with <code>c.insertAsParent(e)</code>, the resulting plan node tree will be:
  
  <pre>
  A
  / | \
  /  |  \
  B   E   D
  |
  |
  C
  </pre>
  
  </p>
  <p>
  Also note that the node on which this method is called ('C' in the example above) will always be added as the
  {@link #addLastChild(PlanNode) last child} to the new parent. This allows the new parent to already have children before
  this method is called.
  </p>
  
  @param newParent the new parent; method does nothing if this is null