From 925a1666b616c12e6738d4d8307fb97cf5e6027b Mon Sep 17 00:00:00 2001 From: Kui LIU Date: Thu, 27 Jul 2017 14:53:54 +0200 Subject: [PATCH] Ignore INS actions. --- .../uni/serval/FixPatternParser/Parser.java | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/main/java/edu/lu/uni/serval/FixPatternParser/Parser.java b/src/main/java/edu/lu/uni/serval/FixPatternParser/Parser.java index 4889935..f806db8 100644 --- a/src/main/java/edu/lu/uni/serval/FixPatternParser/Parser.java +++ b/src/main/java/edu/lu/uni/serval/FixPatternParser/Parser.java @@ -60,24 +60,25 @@ public class Parser { String actionStr = actionSet.getActionString(); String astNodeType = actionSet.getAstNodeType(); if (actionStr.startsWith("INS")) { - startPosition2 = actionSet.getStartPosition(); - endPosition2 = startPosition2 + actionSet.getLength(); - - if ("EnhancedForStatement".equals(astNodeType) || "ForStatement".equals(astNodeType) - || "DoStatement".equals(astNodeType) || "WhileStatement".equals(astNodeType) - || "LabeledStatement".equals(astNodeType) || "SynchronizedStatement".equals(astNodeType) - || "IfStatement".equals(astNodeType) || "TryStatement".equals(astNodeType)) { - List firstAndLastMov = getFirstAndLastMoveAction(actionSet); - if (firstAndLastMov != null) { - startPosition = firstAndLastMov.get(0).getNode().getPos(); - ITree lastTree = firstAndLastMov.get(1).getNode(); - endPosition = lastTree.getPos() + lastTree.getLength(); - } else { // Pure insert actions without any move actions. - continue; - } - } else { // other insert statements - continue; - } + continue; +// startPosition2 = actionSet.getStartPosition(); +// endPosition2 = startPosition2 + actionSet.getLength(); +// +// if ("EnhancedForStatement".equals(astNodeType) || "ForStatement".equals(astNodeType) +// || "DoStatement".equals(astNodeType) || "WhileStatement".equals(astNodeType) +// || "LabeledStatement".equals(astNodeType) || "SynchronizedStatement".equals(astNodeType) +// || "IfStatement".equals(astNodeType) || "TryStatement".equals(astNodeType)) { +// List firstAndLastMov = getFirstAndLastMoveAction(actionSet); +// if (firstAndLastMov != null) { +// startPosition = firstAndLastMov.get(0).getNode().getPos(); +// ITree lastTree = firstAndLastMov.get(1).getNode(); +// endPosition = lastTree.getPos() + lastTree.getLength(); +// } else { // Pure insert actions without any move actions. +// continue; +// } +// } else { // other insert statements +// continue; +// } } else if (actionStr.startsWith("UPD")) { startPosition = actionSet.getStartPosition(); endPosition = startPosition + actionSet.getLength();