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