code: @Override
  	public void addChild(Tree t) {
  		//System.out.println("add child "+t.toStringTree()+" "+this.toStringTree());
  		//System.out.println("existing children: "+children);
  		if ( t==null ) {
  			return; // do nothing upon addChild(null)
  		}
  		BaseTree childTree = (BaseTree)t;
  		if ( childTree.isNil() ) { // t is an empty node possibly with children
  			if ( this.children!=null && this.children == childTree.children ) {
  				throw new RuntimeException("attempt to add child list to itself");
  			}
  			// just add all of childTree's children to this
  			if ( childTree.children!=null ) {
  				if ( this.children!=null ) { // must copy, this has children already
  					int n = childTree.children.size();
  					for (int i = 0; i < n; i++) {
  						Tree c = (Tree)childTree.children.get(i);
  						this.children.add(c);
  						// handle double-link stuff for each child of nil root
  						c.setParent(this);
  						c.setChildIndex(children.size()-1);
  					}
  				}
  				else {
  					// no children for this but t has children; just set pointer
  					// call general freshener routine
  					this.children = childTree.children;
  					this.freshenParentAndChildIndexes();
  				}
  			}
  		}
  		else { // child is not nil (don't care about children)
  			if ( children==null ) {
  				children = createChildrenList(); // create children list on demand
  			}
  			children.add(t);
  			childTree.setParent(this);
  			childTree.setChildIndex(children.size()-1);
  		}
  		// System.out.println("now children are: "+children);
  	}
docs: Add t as child of this node.
  
  Warning: if t has no children, but child does
  and child isNil then this routine moves children to t via
  t.children = child.children; i.e., without copying the array.