Output GumTree results step by step.
This commit is contained in:
@@ -14,6 +14,7 @@ import com.github.gumtreediff.actions.model.Move;
|
||||
import com.github.gumtreediff.actions.model.Update;
|
||||
import com.github.gumtreediff.tree.ITree;
|
||||
|
||||
import edu.lu.uni.serval.config.Configuration;
|
||||
import edu.lu.uni.serval.gumtree.GumTreeComparer;
|
||||
import edu.lu.uni.serval.gumtree.regroup.ActionFilter;
|
||||
import edu.lu.uni.serval.gumtree.regroup.HierarchicalActionSet;
|
||||
@@ -127,7 +128,7 @@ public class Parser {
|
||||
if (simpleTree == null) { // Failed to get the simple tree for INS actions.
|
||||
continue;
|
||||
}
|
||||
this.buggyTrees += "BUGGY_TREE###\n" + simpleTree.toString() + "\n";
|
||||
this.buggyTrees += Configuration.BUGGY_TREE_TOKEN + "\n" + simpleTree.toString() + "\n";
|
||||
|
||||
// Source Code of patches.
|
||||
String patchSourceCode = getPatchSourceCode(sourceCode, startLineNum, endLineNum, startLineNum2,
|
||||
|
||||
@@ -49,6 +49,9 @@ public class ParseFixPatternWorker extends UntypedActor {
|
||||
StringBuilder patchesSourceCode = new StringBuilder();
|
||||
StringBuilder sizes = new StringBuilder();
|
||||
StringBuilder buggyTrees = new StringBuilder();
|
||||
|
||||
int id = msg.getId();
|
||||
int counter = 0;
|
||||
for (MessageFile msgFile : files) {
|
||||
File revFile = msgFile.getRevFile();
|
||||
File prevFile = msgFile.getPrevFile();
|
||||
@@ -61,13 +64,23 @@ public class ParseFixPatternWorker extends UntypedActor {
|
||||
sizes.append(miner.getSizes());
|
||||
buggyTrees.append(miner.getBuggyTrees());
|
||||
log.info("Finish of parsing file: " + revFile.getPath());
|
||||
counter ++;
|
||||
if (counter % 1000 == 0) {
|
||||
FileHelper.outputToFile(editScriptsFilePath + "edistScripts_" + id + ".list", editScripts, true);
|
||||
FileHelper.outputToFile(patchesSourceCodeFilePath + "patches_" + id + ".list", patchesSourceCode, true);
|
||||
FileHelper.outputToFile(editScriptSizesFilePath + "sizes_" + id + ".list", sizes, true);
|
||||
FileHelper.outputToFile(buggyTreesFilePath + "buggyTrees_" + id + ".list", buggyTrees, true);
|
||||
editScripts.setLength(0);
|
||||
patchesSourceCode.setLength(0);
|
||||
sizes.setLength(0);
|
||||
buggyTrees.setLength(0);
|
||||
}
|
||||
}
|
||||
|
||||
int id = msg.getId();
|
||||
FileHelper.outputToFile(editScriptsFilePath + "edistScripts" + id + ".list", editScripts, false);
|
||||
FileHelper.outputToFile(patchesSourceCodeFilePath + "patches" + id + ".list", patchesSourceCode, false);
|
||||
FileHelper.outputToFile(editScriptSizesFilePath + "sizes" + id + ".list", sizes, false);
|
||||
FileHelper.outputToFile(buggyTreesFilePath + "buggyTrees" + id + ".list", buggyTrees, false);
|
||||
FileHelper.outputToFile(editScriptsFilePath + "edistScripts_" + id + ".list", editScripts, true);
|
||||
FileHelper.outputToFile(patchesSourceCodeFilePath + "patches_" + id + ".list", patchesSourceCode, true);
|
||||
FileHelper.outputToFile(editScriptSizesFilePath + "sizes_" + id + ".list", sizes, true);
|
||||
FileHelper.outputToFile(buggyTreesFilePath + "buggyTrees_" + id + ".list", buggyTrees, true);
|
||||
|
||||
log.info("Worker #" + id + " finished the work...");
|
||||
this.getSender().tell("STOP", getSelf());
|
||||
|
||||
Reference in New Issue
Block a user