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