Output positions and alarmtypes together.
This commit is contained in:
@@ -4,15 +4,12 @@ import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import edu.lu.uni.serval.config.Configuration;
|
||||
import edu.lu.uni.serval.utils.FileHelper;
|
||||
|
||||
public class TestViolationParser {
|
||||
|
||||
private static final String REPO_PATH = "/Volumes/MacBook/repos/";
|
||||
private static final String previousFilesPath = "GumTreeInput/prevFiles/";
|
||||
private static final String revisedFilesPath = "GumTreeInput/revFiles/";
|
||||
private static final String positionsFilePath = "GumTreeInput/positions/";
|
||||
private static final String diffentryFilePath = "GumTreeInput/diffentries/";
|
||||
|
||||
public static void main(String[] args) {
|
||||
List<File> repositoriesList = new ArrayList<>();
|
||||
@@ -30,6 +27,11 @@ public class TestViolationParser {
|
||||
}
|
||||
String fixedAlarmFile = "Dataset/fixed-alarms-v0.2.list";
|
||||
|
||||
|
||||
final String previousFilesPath = Configuration.GUM_TREE_INPUT + "prevFiles/";
|
||||
final String revisedFilesPath = Configuration.GUM_TREE_INPUT + "revFiles/";
|
||||
final String positionsFilePath = Configuration.GUM_TREE_INPUT + "positions/";
|
||||
final String diffentryFilePath = Configuration.GUM_TREE_INPUT + "diffentries/";
|
||||
FileHelper.createDirectory(previousFilesPath);
|
||||
FileHelper.createDirectory(revisedFilesPath);
|
||||
FileHelper.createDirectory(positionsFilePath);
|
||||
|
||||
@@ -92,7 +92,7 @@ public class ViolationParser {
|
||||
String diffentryFile = diffentryFilePath + fileName;
|
||||
FileHelper.outputToFile(buggyFile, buggyFileContent, false);
|
||||
FileHelper.outputToFile(fixedFile, fixedFileContent, false);
|
||||
FileHelper.outputToFile(positionFile, readPosition(alarm.getPositions()), false);
|
||||
FileHelper.outputToFile(positionFile, readPosition(alarm.getPositions(), alarm.getAlarmTypes()), false);
|
||||
FileHelper.outputToFile(diffentryFile, diffentry, false);
|
||||
}
|
||||
} catch (GitRepositoryNotFoundException e) {
|
||||
@@ -194,7 +194,7 @@ public class ViolationParser {
|
||||
String diffentryFile = diffentryFilePath + fileName;
|
||||
FileHelper.outputToFile(buggyFile, buggyFileContent, false);
|
||||
FileHelper.outputToFile(fixedFile, fixedFileContent, false);
|
||||
FileHelper.outputToFile(positionFile, readPosition(alarm.getPositions()), false);
|
||||
FileHelper.outputToFile(positionFile, readPosition(alarm.getPositions(), alarm.getAlarmTypes()), false);
|
||||
FileHelper.outputToFile(diffentryFile, diffentry, false);
|
||||
}
|
||||
} catch (GitRepositoryNotFoundException e) {
|
||||
@@ -216,12 +216,12 @@ public class ViolationParser {
|
||||
System.out.println(a);
|
||||
}
|
||||
|
||||
private String readPosition(Map<Integer, String> positions) {
|
||||
private String readPosition(Map<Integer, Integer> positions, Map<Integer, String> alarmTypes) {
|
||||
String positionsStr = "";
|
||||
for (Map.Entry<Integer, String> entry : positions.entrySet()) {
|
||||
positionsStr += entry.getKey() + ":" + entry.getValue() + "\n";
|
||||
for (Map.Entry<Integer, String> entry : alarmTypes.entrySet()) {
|
||||
int key = entry.getKey();
|
||||
positionsStr += key + ":" + positions.get(key) + ":" + entry.getValue() + "\n";
|
||||
}
|
||||
return positionsStr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user