Seperate the end line and alarm type in Alarm.
This commit is contained in:
@@ -8,7 +8,8 @@ public class Alarm {
|
|||||||
private String buggyFileName;
|
private String buggyFileName;
|
||||||
private String fixedCommitId;
|
private String fixedCommitId;
|
||||||
private String fixedFileName;
|
private String fixedFileName;
|
||||||
private Map<Integer, String> positions;
|
private Map<Integer, String> alarmTypes;
|
||||||
|
private Map<Integer, Integer> positions;
|
||||||
|
|
||||||
public Alarm(String buggyCommitId, String buggyFileName, String fixedCommitId, String fixedFileName) {
|
public Alarm(String buggyCommitId, String buggyFileName, String fixedCommitId, String fixedFileName) {
|
||||||
super();
|
super();
|
||||||
@@ -34,11 +35,19 @@ public class Alarm {
|
|||||||
return fixedFileName;
|
return fixedFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Integer, String> getPositions() {
|
public Map<Integer, String> getAlarmTypes() {
|
||||||
|
return alarmTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAlarmTypes(Map<Integer, String> alarmTypes) {
|
||||||
|
this.alarmTypes = alarmTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<Integer, Integer> getPositions() {
|
||||||
return positions;
|
return positions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPositions(Map<Integer, String> positions) {
|
public void setPositions(Map<Integer, Integer> positions) {
|
||||||
this.positions = positions;
|
this.positions = positions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,12 +28,13 @@ public class AlarmsReader {
|
|||||||
String fixedInfo = line.substring(arrowIndex + 2);
|
String fixedInfo = line.substring(arrowIndex + 2);
|
||||||
String[] buggyElements = buggyInfo.split(":");
|
String[] buggyElements = buggyInfo.split(":");
|
||||||
String[] fixedElements = fixedInfo.split(":");
|
String[] fixedElements = fixedInfo.split(":");
|
||||||
|
|
||||||
|
String alarmType = buggyElements[0];
|
||||||
String projectName = buggyElements[1];
|
String projectName = buggyElements[1];
|
||||||
String buggyCommitId = buggyElements[2];
|
String buggyCommitId = buggyElements[2];
|
||||||
String buggyFile = buggyElements[3];
|
String buggyFile = buggyElements[3];
|
||||||
int startLine = Integer.parseInt(buggyElements[4]);
|
int startLine = Integer.parseInt(buggyElements[4]);
|
||||||
String endLineAndAlarmType = buggyElements[5] + ":" + buggyElements[0];
|
int endLine = Integer.parseInt(buggyElements[5]);
|
||||||
String fixCommitId = fixedElements[1];
|
String fixCommitId = fixedElements[1];
|
||||||
String fixedFile = fixedElements[2];
|
String fixedFile = fixedElements[2];
|
||||||
|
|
||||||
@@ -50,11 +51,23 @@ public class AlarmsReader {
|
|||||||
int index = alarms.indexOf(alarm);
|
int index = alarms.indexOf(alarm);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
Alarm tempAlarm = alarms.get(index);
|
Alarm tempAlarm = alarms.get(index);
|
||||||
Map<Integer, String> positions = tempAlarm.getPositions();
|
Map<Integer, Integer> positions = tempAlarm.getPositions();
|
||||||
positions.put(startLine, endLineAndAlarmType);
|
if (positions.containsKey(startLine)) {
|
||||||
|
int end = positions.get(startLine);
|
||||||
|
if (endLine < end) {
|
||||||
|
positions.put(startLine, endLine);
|
||||||
|
tempAlarm.getAlarmTypes().put(startLine, alarmType);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
positions.put(startLine, endLine);
|
||||||
|
tempAlarm.getAlarmTypes().put(startLine, alarmType);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Map<Integer, String> positions = new HashMap<>();
|
Map<Integer, String> alarmTypes = new HashMap<>();
|
||||||
positions.put(startLine, endLineAndAlarmType);
|
alarmTypes.put(startLine, alarmType);
|
||||||
|
alarm.setAlarmTypes(alarmTypes);
|
||||||
|
Map<Integer, Integer> positions = new HashMap<>();
|
||||||
|
positions.put(startLine, endLine);
|
||||||
alarm.setPositions(positions);
|
alarm.setPositions(positions);
|
||||||
alarms.add(alarm);
|
alarms.add(alarm);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user