start position and lenght for actions

This commit is contained in:
Anil Koyuncu
2018-02-15 15:59:21 +01:00
parent d31e9f9e21
commit 4c80cb4313
3 changed files with 11 additions and 9 deletions
@@ -69,6 +69,9 @@ public class FixedViolationHunkParser extends FixedViolationParser {
int bugEndPosition = 0; int bugEndPosition = 0;
int fixEndPosition = 0; int fixEndPosition = 0;
for (HierarchicalActionSet hunkActionSet : hunkActionSets) { for (HierarchicalActionSet hunkActionSet : hunkActionSets) {
//TODO FIX ME
int actionBugStart = hunkActionSet.getBugStartLineNum(); int actionBugStart = hunkActionSet.getBugStartLineNum();
int actionBugEnd = hunkActionSet.getBugEndLineNum(); int actionBugEnd = hunkActionSet.getBugEndLineNum();
int actionFixStart = hunkActionSet.getFixStartLineNum(); int actionFixStart = hunkActionSet.getFixStartLineNum();
@@ -241,11 +241,10 @@ public class HierarchicalRegrouperForC {
private boolean isStatement(ITree tree) { private boolean isStatement(ITree tree) {
int nodeType = tree.getType(); int nodeType = tree.getType();
// if (nodeType == 280002 || nodeType == 280001 || nodeType == 310200 || nodeType == 280100 if (nodeType == 280002 || nodeType == 280001 || nodeType == 310200 || nodeType == 280100
// || nodeType == 300100 || nodeType == 280003 || nodeType == 310100 || nodeType == 310300 || nodeType == 300100 || nodeType == 280003 || nodeType == 310100 || nodeType == 310300
// || 260300 == nodeType || nodeType == 460000) {// TODO || 260300 == nodeType || nodeType == 460000) {// TODO
if(nodeType == 460000){ return true;
return true;
} }
return false; return false;
} }
@@ -375,14 +375,14 @@ public class HunkActionFilter {
for (HierarchicalActionSet actionSet : actionSets) { for (HierarchicalActionSet actionSet : actionSets) {
String actionStr = actionSet.getActionString(); String actionStr = actionSet.getActionString();
if (actionStr.startsWith("INS")) { if (actionStr.startsWith("INS")) {
int actionFixStartLine = actionSet.getBugStartLineNum(); int actionFixStartLine = actionSet.getStartPosition();
int actionFixEndLine = actionSet.getBugEndLineNum(); int actionFixEndLine = actionSet.getLength();
if (fixHunkStartLine <= actionFixEndLine && fixHunkEndLine >= actionFixStartLine ) { if (fixHunkStartLine <= actionFixEndLine && fixHunkEndLine >= actionFixStartLine ) {
diffentryHunk.getActionSets().add(actionSet); diffentryHunk.getActionSets().add(actionSet);
} }
} else { } else {
int actionBugStartLine = actionSet.getBugStartLineNum(); int actionBugStartLine = actionSet.getStartPosition();
int actionBugEndLine = actionSet.getBugEndLineNum(); int actionBugEndLine = actionSet.getLength();
if (bugHunkStartLine <= actionBugEndLine && bugHunkEndLine >= actionBugStartLine) { if (bugHunkStartLine <= actionBugEndLine && bugHunkEndLine >= actionBugStartLine) {
diffentryHunk.getActionSets().add(actionSet); diffentryHunk.getActionSets().add(actionSet);