n.getParent().addChild(n.getChildPos()+1,r);
n.getParent().addChild(n.getChildPos()+1,r);*/
  public void transform( MarkableBaseNode base, BranchNode variant, BranchNode total,                        MarkableBaseNode baseRoot ) {    boolean editNode = false;    // Decide if node should be edited    if( ! base.isMarked() ) {      _visitCount++;      editNode = _visitCount % 4 == 0 ;    }    BranchNode n = null; // used by edit ops    boolean after = false;    MarkableBaseNode dest = null;    if( editNode ) {      int op = 1;// (int) (rnd.nextDouble() *5.0);      switch(op) {        case 0: // Delete node          System.err.println("DEL");          base = getLargestDelTree(base);          _checkNotMarked(base);          base.lock();          base.lockSubtree();          n = base.getLeft().getFullMatch();          n.getParent().removeChild(n.getChildPos());          n = base.getRight().getFullMatch();          n.getParent().removeChild(n.getChildPos());          break;        case 1: // Insert node          System.err.println("INS");          XMLTextNode content = new XMLTextNode("!INSERT!"+System.currentTimeMillis());          after = rnd.nextDouble() > 0.5;          base.lock(!after,after);          base = after ? base : (base.hasLeftSibling() ?                                 (MarkableBaseNode) base.getLeftSibling() : base);          n = base.getLeft().getFullMatch();          n.getParent().addChild(n.getChildPos()+1,new BranchNode( content));          n = base.getRight().getFullMatch();          n.getParent().addChild(n.getChildPos()+1,new BranchNode( content));          break;        case 2: // Update node          System.err.println("UPD");          break; // N/A for now...        case 3: // Move subtree          System.err.println("MOV");          // Delete from base (src of move) (=delete code block)          base.lock();          BranchNode l = base.getLeft().getFullMatch();          l.getParent().removeChild(l.getChildPos());          BranchNode r = base.getRight().getFullMatch();          r.getParent().removeChild(r.getChildPos());          // Insert at dest (=insert code block)          dest = getRandomNode( baseRoot, true ); // NOTE! Dest must be fetched AFTER src is locked!          after = rnd.nextDouble() > 0.5;          dest.lock(!after,after);          dest = after ? dest : (dest.hasLeftSibling() ?                                 (MarkableBaseNode) dest.getLeftSibling() : dest);          n = dest.getLeft().getFullMatch();          n.getParent().addChild(n.getChildPos()+1,l);          n = dest.getRight().getFullMatch();          n.getParent().addChild(n.getChildPos()+1,r);          break;        case 4: // Copy subtree          System.err.println("CPY");          // Lock src of copy          base.lock();          // Insert at dest (=insert code block)          dest = getRandomNode( baseRoot, true ); // NOTE! Dest must be fetched AFTER src is locked!          after = rnd.nextDouble() > 0.5;          dest.lock(!after,after);          dest = after ? dest : (dest.hasLeftSibling() ?                                 (MarkableBaseNode) dest.getLeftSibling() : dest);          n = dest.getLeft().getFullMatch();          n.getParent().addChild(n.getChildPos()+1,                                 clonedAndMatchedTree(base,true,false));          n = dest.getRight().getFullMatch();          n.getParent().addChild(n.getChildPos()+1,                                 clonedAndMatchedTree(base,false,false));          break;      }    } // if edit node    // recurse    for( int i=0;i<base.getChildCount();i++)      transform((MarkableBaseNode) base.getChild(i),variant,total,baseRoot);  }