Read diff entry file.

This commit is contained in:
Kui LIU
2017-12-22 15:49:14 +01:00
parent cb0472f72b
commit 73bed61655
2 changed files with 11 additions and 0 deletions
@@ -9,6 +9,7 @@ public class DiffEntryHunk {
private String hunk;
private int buggyHunkSize;
private int fixedHunkSize;
private String file;
public DiffEntryHunk(int bugLineStartNum, int fixLineStartNum, int bugRange, int fixRange) {
super();
@@ -58,6 +59,14 @@ public class DiffEntryHunk {
this.fixedHunkSize = fixedHunkSize;
}
public String getFile() {
return file;
}
public void setFile(String file) {
this.file = file;
}
@Override
public String toString() {
return "@@ -" + this.bugLineStartNum + ", " + this.bugRange + " +" + this.fixLineStartNum + ", " + this.fixRange + "\n" + this.hunk;
@@ -184,6 +184,7 @@ public class DiffEntryReader {
diffEntryHunk.setHunk(hunk.toString());
diffEntryHunk.setBuggyHunkSize(buggyHunkSize);
diffEntryHunk.setFixedHunkSize(fixedHunkSize);
diffEntryHunk.setFile(diffentryFile.getPath());
diffentryHunks.add(diffEntryHunk);
}
hunk.setLength(0);
@@ -225,6 +226,7 @@ public class DiffEntryReader {
diffEntryHunk.setHunk(hunk.toString());
diffEntryHunk.setBuggyHunkSize(buggyHunkSize);
diffEntryHunk.setFixedHunkSize(fixedHunkSize);
diffEntryHunk.setFile(diffentryFile.getPath());
diffentryHunks.add(diffEntryHunk);
hunk.setLength(0);
}