String mergeLogFile = "edits-"+mergeFile; try { mergeLog.writeEdits(new XMLPrinter( new java.io.FileOutputStream( mergeLogFile ))); } catch (Exception x ) { System.err.println("Unable to write edit log "+mergeLogFile );
if( editLogPrefix != null ) { String mergeLogFile = editLogPrefix+mergeFile; try { mergeLog.writeEdits(new XMLPrinter( new java.io.FileOutputStream( mergeLogFile ))); } catch (Exception x ) { System.err.println("Unable to write edit log "+mergeLogFile ); } } if( printStats ) { System.err.println("Base tree nodes: "+((MarkableBaseNode) docBase.getChild(0)).getSubteeSize()); System.err.println("        Inserts: "+insCount); System.err.println("        Deletes: "+delCount); System.err.println("        Updates: "+updCount); System.err.println("          Moves: "+moveCount); System.err.println("         Copies: "+copyCount); System.err.println("    Total edits: "+(insCount+delCount+updCount+moveCount+copyCount));
  public void editGen( String inFile, String mergeFile, String[] outfiles ) {    // Parse infile   MarkableBaseNode docBase=null;   BranchNode docMerged=null;   try {     XMLParser p = new XMLParser();     docBase = (MarkableBaseNode) p.parse( inFile,baseNodeFactory);     countSubtreeSizes(docBase,0); // We ned subtree counts to alloc a random node   } catch ( Exception e ) {     System.err.println("XML Parse error in " + inFile +                        ". Detailed exception info is:" );     System.err.println( e.toString() );     e.printStackTrace();     return;   }   // Make merge clone   // total merge is left tree, current working tree is right   docMerged = clonedAndMatchedTree( docBase, true, true );   EditLog mergeLog = new EditLog();   // Make variants   for( int iFile = 0; iFile < outfiles.length; iFile++ ) {     System.err.println("Making "+outfiles[iFile]+"...");     EditLog branchLog = new EditLog();     BranchNode outRoot = clonedAndMatchedTree( docBase, false, true );     ((MarkableBaseNode) docBase.getChild(0)).mark(); // Never edit root elem     transform( (MarkableBaseNode) docBase.getChild(0),                (MarkableBaseNode) docBase.getChild(0), mergeLog, branchLog);     try {       printTree( outRoot, new XMLPrinter( new java.io.FileOutputStream( outfiles[iFile] )));     } catch (java.io.IOException x ) {       System.err.println("Unable to write outfile "+outfiles[iFile] );     }     String editLogFile = "edits-"+outfiles[iFile];     try {       branchLog.writeEdits(new XMLPrinter( new java.io.FileOutputStream( editLogFile )));     } catch (Exception x ) {       System.err.println("Unable to write edit log "+editLogFile );     }   }   // Write merge facit   try {     printTree( docMerged, new XMLPrinter( new java.io.FileOutputStream( mergeFile )));   } catch (java.io.IOException x ) {     System.err.println("Unable to write outfile "+mergeFile );   }   // Write combined log   String mergeLogFile = "edits-"+mergeFile;   try {     mergeLog.writeEdits(new XMLPrinter( new java.io.FileOutputStream( mergeLogFile )));   } catch (Exception x ) {     System.err.println("Unable to write edit log "+mergeLogFile );   }  }