From 9fa6bae24ca57bd55527ff823d12ee26b22c0edf Mon Sep 17 00:00:00 2001 From: Kui LIU Date: Mon, 31 Jul 2017 10:53:50 +0200 Subject: [PATCH] Optimize the algorithm of parsing GumTree result actions. --- .../uni/serval/gumtree/regroup/HierarchicalRegrouper.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/edu/lu/uni/serval/gumtree/regroup/HierarchicalRegrouper.java b/src/main/java/edu/lu/uni/serval/gumtree/regroup/HierarchicalRegrouper.java index caf26d6..b49e0bb 100644 --- a/src/main/java/edu/lu/uni/serval/gumtree/regroup/HierarchicalRegrouper.java +++ b/src/main/java/edu/lu/uni/serval/gumtree/regroup/HierarchicalRegrouper.java @@ -84,9 +84,10 @@ public class HierarchicalRegrouper { String nodeType = actStrFrag.substring(index); if (!"".equals(nodeType)) { try { - nodeType = ASTNodeMap.map.get(Integer.parseInt(nodeType)); + String type = ASTNodeMap.map.get(Integer.parseInt(nodeType)); + nodeType = type; } catch (NumberFormatException e) { - nodeType = actStrFrag.substring(index); +// nodeType = actStrFrag.substring(index); } } actStrFrag = actStrFrag.substring(0, index) + nodeType + "@@"; @@ -158,7 +159,7 @@ public class HierarchicalRegrouper { ITree parent = action.getNode().getParent(); if (action instanceof Addition) { - parent = ((Addition) action).getParent(); + parent = ((Addition) action).getParent(); // parent in the fixed source code tree } for (Action act : actions) { if (act.getNode().equals(parent)) {