Output buggy trees and edit script sizes.
This commit is contained in:
@@ -24,8 +24,12 @@ public class AkkaParser {
|
||||
// output path
|
||||
final String editScriptsFilePath = "../GumTreeResults/editScripts/";
|
||||
final String patchesSourceCodeFilePath = "../GumTreeResults/sourceCode/";
|
||||
final String buggyTreesFilePath = "../GumTreeResults/buggyTrees/";
|
||||
final String editScriptSizesFilePath = "../GumTreeResults/editScriptSizes/";
|
||||
FileHelper.deleteDirectory(editScriptsFilePath);
|
||||
FileHelper.deleteDirectory(patchesSourceCodeFilePath);
|
||||
FileHelper.deleteDirectory(buggyTreesFilePath);
|
||||
FileHelper.deleteDirectory(editScriptSizesFilePath);
|
||||
|
||||
ActorSystem system = null;
|
||||
ActorRef parsingActor = null;
|
||||
@@ -34,7 +38,7 @@ public class AkkaParser {
|
||||
try {
|
||||
log.info("Akka begins...");
|
||||
system = ActorSystem.create("Mining-FixPattern-System");
|
||||
parsingActor = system.actorOf(ParseFixPatternActor.props(numberOfWorkers, editScriptsFilePath, patchesSourceCodeFilePath), "mine-fix-pattern-actor");
|
||||
parsingActor = system.actorOf(ParseFixPatternActor.props(numberOfWorkers, editScriptsFilePath, patchesSourceCodeFilePath, buggyTreesFilePath, editScriptSizesFilePath), "mine-fix-pattern-actor");
|
||||
parsingActor.tell(msg, ActorRef.noSender());
|
||||
} catch (Exception e) {
|
||||
system.shutdown();
|
||||
|
||||
@@ -20,13 +20,13 @@ public class ParseFixPatternActor extends UntypedActor {
|
||||
private final int numberOfWorkers;
|
||||
private int counter = 0;
|
||||
|
||||
public ParseFixPatternActor(int numberOfWorkers, String editScriptsFilePath, String patchesSourceCodeFilePath) {
|
||||
public ParseFixPatternActor(int numberOfWorkers, String editScriptsFilePath, String patchesSourceCodeFilePath, String buggyTreesFilePath, String editScriptSizesFilePath) {
|
||||
mineRouter = this.getContext().actorOf(new RoundRobinPool(numberOfWorkers)
|
||||
.props(ParseFixPatternWorker.props(editScriptsFilePath, patchesSourceCodeFilePath)), "mine-fix-pattern-router");
|
||||
.props(ParseFixPatternWorker.props(editScriptsFilePath, patchesSourceCodeFilePath, buggyTreesFilePath, editScriptSizesFilePath)), "mine-fix-pattern-router");
|
||||
this.numberOfWorkers = numberOfWorkers;
|
||||
}
|
||||
|
||||
public static Props props(final int numberOfWorkers, final String editScriptsFilePath, final String patchesSourceCodeFilePath) {
|
||||
public static Props props(final int numberOfWorkers, final String editScriptsFilePath, final String patchesSourceCodeFilePath, final String buggyTreesFilePath, final String editScriptSizesFilePath) {
|
||||
|
||||
return Props.create(new Creator<ParseFixPatternActor>() {
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ParseFixPatternActor extends UntypedActor {
|
||||
|
||||
@Override
|
||||
public ParseFixPatternActor create() throws Exception {
|
||||
return new ParseFixPatternActor(numberOfWorkers, editScriptsFilePath, patchesSourceCodeFilePath);
|
||||
return new ParseFixPatternActor(numberOfWorkers, editScriptsFilePath, patchesSourceCodeFilePath, buggyTreesFilePath, editScriptSizesFilePath);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -17,20 +17,24 @@ public class ParseFixPatternWorker extends UntypedActor {
|
||||
|
||||
private String editScriptsFilePath;
|
||||
private String patchesSourceCodeFilePath;
|
||||
private String editScriptSizesFilePath;
|
||||
private String buggyTreesFilePath;
|
||||
|
||||
public ParseFixPatternWorker(String editScriptsFilePath, String patchesSourceCodeFilePath) {
|
||||
public ParseFixPatternWorker(String editScriptsFilePath, String patchesSourceCodeFilePath, String buggyTreesFilePath, String editScriptSizesFilePath) {
|
||||
this.editScriptsFilePath = editScriptsFilePath;
|
||||
this.patchesSourceCodeFilePath = patchesSourceCodeFilePath;
|
||||
this.editScriptSizesFilePath = editScriptSizesFilePath;
|
||||
this.buggyTreesFilePath = buggyTreesFilePath;
|
||||
}
|
||||
|
||||
public static Props props(final String editScriptsFile, final String patchesSourceCodeFile) {
|
||||
public static Props props(final String editScriptsFile, final String patchesSourceCodeFile, final String buggyTreesFilePath, final String editScriptSizesFilePath) {
|
||||
return Props.create(new Creator<ParseFixPatternWorker>() {
|
||||
|
||||
private static final long serialVersionUID = -7615153844097275009L;
|
||||
|
||||
@Override
|
||||
public ParseFixPatternWorker create() throws Exception {
|
||||
return new ParseFixPatternWorker(editScriptsFile, patchesSourceCodeFile);
|
||||
return new ParseFixPatternWorker(editScriptsFile, patchesSourceCodeFile, buggyTreesFilePath, editScriptSizesFilePath);
|
||||
}
|
||||
|
||||
});
|
||||
@@ -44,6 +48,7 @@ public class ParseFixPatternWorker extends UntypedActor {
|
||||
StringBuilder editScripts = new StringBuilder();
|
||||
StringBuilder patchesSourceCode = new StringBuilder();
|
||||
StringBuilder sizes = new StringBuilder();
|
||||
StringBuilder buggyTrees = new StringBuilder();
|
||||
for (MessageFile msgFile : files) {
|
||||
File revFile = msgFile.getRevFile();
|
||||
File prevFile = msgFile.getPrevFile();
|
||||
@@ -54,13 +59,15 @@ public class ParseFixPatternWorker extends UntypedActor {
|
||||
editScripts.append(miner.getAstEditScripts());
|
||||
patchesSourceCode.append(miner.getPatchesSourceCode());
|
||||
sizes.append(miner.getSizes());
|
||||
buggyTrees.append(miner.getBuggyTrees());
|
||||
log.info("Finish of parsing file: " + revFile.getPath());
|
||||
}
|
||||
|
||||
int id = msg.getId();
|
||||
FileHelper.outputToFile(editScriptsFilePath + "edistScripts" + id + ".list", editScripts, false);
|
||||
FileHelper.outputToFile(patchesSourceCodeFilePath + "patches" + id + ".list", patchesSourceCode, false);
|
||||
FileHelper.outputToFile(patchesSourceCodeFilePath + "sizes" + id + ".list", sizes, false);
|
||||
FileHelper.outputToFile(editScriptSizesFilePath + "sizes" + id + ".list", sizes, false);
|
||||
FileHelper.outputToFile(buggyTreesFilePath + "buggyTrees" + id + ".list", buggyTrees, false);
|
||||
|
||||
log.info("Worker #" + id + " finished the work...");
|
||||
this.getSender().tell("STOP", getSelf());
|
||||
|
||||
Reference in New Issue
Block a user