protected void copy( BranchNode patch, BranchNode diff, BaseNode srcRoot, Object src,
protected void copy( BranchNode patch, BranchNode diff, Node srcRoot,Object src,
  protected void copy( BranchNode patch, BranchNode diff, BaseNode srcRoot, Object src,                      IdIndex index )                      throws ParseException {    // Gather the stopnodes for the copy    Vector dstNodes = new Vector();    Map stopNodes = new HashMap();    long nsrc=-1;    long run = 1;    try {      String runS = ((XMLElementNode) diff.getContent()).getAttributes().getValue("run");      if (runS != null)        run = Long.parseLong(runS);      if( run > 1 )        nsrc = Long.parseLong(src.toString());    } catch ( Exception e ) {      throw new ParseException("DIFFSYNTAX: Invalid run count/non-number src for copy tag " +                               diff.toString() );    }    for( int i = 0; i < diff.getChildCount(); i++ ) {      XMLNode content = diff.getChild(i).getContent();      Node stopNode = null;      // Sanity check      if( content instanceof XMLTextNode || (        !((XMLElementNode) content).getQName().equals(Diff.DIFF_NS+"copy") &&        !((XMLElementNode) content).getQName().equals(Diff.DIFF_NS+"insert") ) )        throw new ParseException("DIFFSYNTAX: Only copy or insert commands may"+                                 " appear below a copy command");      XMLElementNode stopCommand = (XMLElementNode) content;      try {        stopNode = index.lookup(                                stopCommand.getAttributes().getValue("dst"));      } catch ( Exception e ) {        throw new ParseException("DIFFSYNTAX: Invalid parameters in command " +                                 stopNode.toString() );      }      dstNodes.add( stopNode );      if( !stopNodes.containsKey(stopNode) )        stopNodes.put(stopNode,null);    }    // Run copy. stopNode values are at the same time filled in to point to the    // created nodes    for( long iRun=1;iRun<run;iRun++) {      dfsCopy(patch,srcRoot,null);      srcRoot = (BaseNode) index.lookup(String.valueOf(nsrc+iRun));    }    dfsCopy( patch, srcRoot , stopNodes );    // Recurse for each diff child    for( int i = 0; i < diff.getChildCount(); i++ ) {      // DEBUG      /*BranchNode _n = (BranchNode) stopNodes.get( dstNodes.elementAt(i) );      if(  _n == null  ) {        BaseNode _s = (BaseNode) dstNodes.elementAt(i);        System.err.println("Internal failure: Stop node not created");        System.err.println("src path=" + PathTracker.getPathString(srcRoot) );        System.err.println("stop path=" + PathTracker.getPathString(_s ));      }*/      //ENDDEBUG      insert( (BranchNode) stopNodes.get( dstNodes.elementAt(i) ),              diff.getChild(i), index);    }  }