Get the sizes of all editscripts.
This commit is contained in:
@@ -33,7 +33,7 @@ public class Parser {
|
|||||||
private String astEditScripts = "";
|
private String astEditScripts = "";
|
||||||
private String patchesSourceCode = "";
|
private String patchesSourceCode = "";
|
||||||
private String buggyTrees = "";
|
private String buggyTrees = "";
|
||||||
private int maxSize = 0;
|
private String sizes = "";
|
||||||
|
|
||||||
public void parseFixPatterns(File prevFile, File revFile, File diffEntryFile) throws FileNotFoundException, IOException {
|
public void parseFixPatterns(File prevFile, File revFile, File diffEntryFile) throws FileNotFoundException, IOException {
|
||||||
// GumTree results
|
// GumTree results
|
||||||
@@ -143,9 +143,7 @@ public class Parser {
|
|||||||
// 1. First level: AST node type.
|
// 1. First level: AST node type.
|
||||||
String astEditScripts = getASTEditScripts(actionSet);
|
String astEditScripts = getASTEditScripts(actionSet);
|
||||||
int size = astEditScripts.split(" ").length;
|
int size = astEditScripts.split(" ").length;
|
||||||
if (size > maxSize) {
|
this.sizes += size + "\n";
|
||||||
maxSize = size;
|
|
||||||
}
|
|
||||||
this.astEditScripts += astEditScripts + "\n";
|
this.astEditScripts += astEditScripts + "\n";
|
||||||
// 2. source code: raw tokens
|
// 2. source code: raw tokens
|
||||||
String rawTokenEditScripts = getRawTokenEditScripts(actionSet);
|
String rawTokenEditScripts = getRawTokenEditScripts(actionSet);
|
||||||
@@ -363,12 +361,11 @@ public class Parser {
|
|||||||
return patchesSourceCode;
|
return patchesSourceCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxSize() {
|
|
||||||
return maxSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBuggyTrees() {
|
public String getBuggyTrees() {
|
||||||
return buggyTrees;
|
return buggyTrees;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSizes() {
|
||||||
|
return sizes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class ParseFixPatternWorker extends UntypedActor {
|
|||||||
List<MessageFile> files = msg.getMsgFiles();
|
List<MessageFile> files = msg.getMsgFiles();
|
||||||
StringBuilder editScripts = new StringBuilder();
|
StringBuilder editScripts = new StringBuilder();
|
||||||
StringBuilder patchesSourceCode = new StringBuilder();
|
StringBuilder patchesSourceCode = new StringBuilder();
|
||||||
int maxSize = 0;
|
StringBuilder sizes = 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();
|
||||||
@@ -53,16 +53,14 @@ public class ParseFixPatternWorker extends UntypedActor {
|
|||||||
miner.parseFixPatterns(prevFile, revFile, diffentryFile);
|
miner.parseFixPatterns(prevFile, revFile, diffentryFile);
|
||||||
editScripts.append(miner.getAstEditScripts());
|
editScripts.append(miner.getAstEditScripts());
|
||||||
patchesSourceCode.append(miner.getPatchesSourceCode());
|
patchesSourceCode.append(miner.getPatchesSourceCode());
|
||||||
int size = miner.getMaxSize();
|
sizes.append(miner.getSizes());
|
||||||
if (size > maxSize) {
|
|
||||||
maxSize = size;
|
|
||||||
}
|
|
||||||
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 + "_MaxSize=" + maxSize + ".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);
|
||||||
|
|
||||||
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