Add constructors.
This commit is contained in:
+6
@@ -23,6 +23,12 @@ import edu.lu.uni.serval.utils.ListSorter;
|
|||||||
public class FixedViolationHunkParser extends FixedViolationParser {
|
public class FixedViolationHunkParser extends FixedViolationParser {
|
||||||
int counter;
|
int counter;
|
||||||
|
|
||||||
|
public FixedViolationHunkParser() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public FixedViolationHunkParser(File positionFile) {
|
||||||
|
setPositionFile(positionFile);
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public void parseFixPatterns(File prevFile, File revFile, File diffentryFile) {
|
public void parseFixPatterns(File prevFile, File revFile, File diffentryFile) {
|
||||||
// GumTree results
|
// GumTree results
|
||||||
|
|||||||
@@ -63,8 +63,7 @@ public class TestHunkParser {
|
|||||||
msgFile.getRevFile(), msgFile.getDiffEntryFile(), parser));
|
msgFile.getRevFile(), msgFile.getDiffEntryFile(), parser));
|
||||||
try {
|
try {
|
||||||
// where we wait for task to complete
|
// where we wait for task to complete
|
||||||
// future.get(Configuration.SECONDS_TO_WAIT, TimeUnit.SECONDS);
|
future.get(Configuration.SECONDS_TO_WAIT, TimeUnit.SECONDS);
|
||||||
future.get(20L, TimeUnit.SECONDS);
|
|
||||||
String editScripts = parser.getAstEditScripts();
|
String editScripts = parser.getAstEditScripts();
|
||||||
if (!editScripts.equals("")) {
|
if (!editScripts.equals("")) {
|
||||||
astEditScripts.append(editScripts);
|
astEditScripts.append(editScripts);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class AkkaParser {
|
|||||||
// input data
|
// input data
|
||||||
log.info("Get the input data...");
|
log.info("Get the input data...");
|
||||||
// final List<MessageFile> msgFiles = getMessageFiles();
|
// final List<MessageFile> msgFiles = getMessageFiles();
|
||||||
final List<MessageFile> msgFiles = getMessageFiles("GumTreeInput/");
|
final List<MessageFile> msgFiles = getMessageFiles(Configuration.GUM_TREE_INPUT);
|
||||||
log.info("MessageFiles: " + msgFiles.size());
|
log.info("MessageFiles: " + msgFiles.size());
|
||||||
|
|
||||||
// output path
|
// output path
|
||||||
@@ -44,7 +44,7 @@ public class AkkaParser {
|
|||||||
|
|
||||||
ActorSystem system = null;
|
ActorSystem system = null;
|
||||||
ActorRef parsingActor = null;
|
ActorRef parsingActor = null;
|
||||||
int numberOfWorkers = 20;
|
int numberOfWorkers = 30;
|
||||||
final WorkMessage msg = new WorkMessage(0, msgFiles);
|
final WorkMessage msg = new WorkMessage(0, msgFiles);
|
||||||
try {
|
try {
|
||||||
log.info("Akka begins...");
|
log.info("Akka begins...");
|
||||||
|
|||||||
@@ -72,17 +72,16 @@ public class ParseFixPatternWorker extends UntypedActor {
|
|||||||
int counter = 0;
|
int counter = 0;
|
||||||
boolean containsAlarmTypes = false;
|
boolean containsAlarmTypes = false;
|
||||||
for (MessageFile msgFile : files) {
|
for (MessageFile msgFile : files) {
|
||||||
counter ++;
|
|
||||||
File revFile = msgFile.getRevFile();
|
File revFile = msgFile.getRevFile();
|
||||||
File prevFile = msgFile.getPrevFile();
|
File prevFile = msgFile.getPrevFile();
|
||||||
File diffentryFile = msgFile.getDiffEntryFile();
|
File diffentryFile = msgFile.getDiffEntryFile();
|
||||||
File positionFile = msgFile.getPositionFile();
|
File positionFile = msgFile.getPositionFile();
|
||||||
Parser parser = null;
|
Parser parser = null;
|
||||||
if (positionFile == null) {
|
if (containsAlarmTypes || positionFile != null) {
|
||||||
parser = new CommitPatchSingleStatementParser();
|
parser = new FixedViolationHunkParser(positionFile);
|
||||||
} else {
|
|
||||||
parser = new FixedViolationHunkParser();
|
|
||||||
containsAlarmTypes = true;
|
containsAlarmTypes = true;
|
||||||
|
} else {
|
||||||
|
parser = new CommitPatchSingleStatementParser();
|
||||||
}
|
}
|
||||||
|
|
||||||
final ExecutorService executor = Executors.newSingleThreadExecutor();
|
final ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||||
@@ -98,8 +97,10 @@ public class ParseFixPatternWorker extends UntypedActor {
|
|||||||
patchesSourceCode.append(parser.getPatchesSourceCode());
|
patchesSourceCode.append(parser.getPatchesSourceCode());
|
||||||
sizes.append(parser.getSizes());
|
sizes.append(parser.getSizes());
|
||||||
tokens.append(parser.getTokensOfSourceCode());
|
tokens.append(parser.getTokensOfSourceCode());
|
||||||
if (positionFile == null) alarmTypes.append(((FixedViolationHunkParser) parser).getAlarmTypes());
|
if (containsAlarmTypes) {
|
||||||
|
alarmTypes.append(((FixedViolationHunkParser) parser).getAlarmTypes());
|
||||||
|
}
|
||||||
|
counter ++;
|
||||||
if (counter % 100 == 0) {
|
if (counter % 100 == 0) {
|
||||||
FileHelper.outputToFile(editScriptsFilePath + "edistScripts_" + id + ".list", editScripts, true);
|
FileHelper.outputToFile(editScriptsFilePath + "edistScripts_" + id + ".list", editScripts, true);
|
||||||
FileHelper.outputToFile(patchesSourceCodeFilePath + "patches_" + id + ".list", patchesSourceCode, true);
|
FileHelper.outputToFile(patchesSourceCodeFilePath + "patches_" + id + ".list", patchesSourceCode, true);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class TestViolationParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String fixedAlarmFile = "Dataset/fixed-alarms.list.txt";
|
String fixedAlarmFile = "Dataset/fixed-alarms-v0.2.list";
|
||||||
|
|
||||||
FileHelper.createDirectory(previousFilesPath);
|
FileHelper.createDirectory(previousFilesPath);
|
||||||
FileHelper.createDirectory(revisedFilesPath);
|
FileHelper.createDirectory(revisedFilesPath);
|
||||||
|
|||||||
Reference in New Issue
Block a user