Output the simple tree of buggy code.
This commit is contained in:
@@ -23,7 +23,7 @@ import edu.lu.uni.serval.gumtree.utils.CUCreator;
|
|||||||
import edu.lu.uni.serval.utils.FileHelper;
|
import edu.lu.uni.serval.utils.FileHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse fix patterns with GumTree..
|
* Parse fix patterns with GumTree.
|
||||||
*
|
*
|
||||||
* @author kui.liu
|
* @author kui.liu
|
||||||
*
|
*
|
||||||
@@ -32,6 +32,7 @@ public class Parser {
|
|||||||
|
|
||||||
private String astEditScripts = "";
|
private String astEditScripts = "";
|
||||||
private String patchesSourceCode = "";
|
private String patchesSourceCode = "";
|
||||||
|
private String buggyTrees = "";
|
||||||
private int maxSize = 0;
|
private int maxSize = 0;
|
||||||
|
|
||||||
public void mineFixPatterns(File prevFile, File revFile, File diffEntryFile) throws FileNotFoundException, IOException {
|
public void mineFixPatterns(File prevFile, File revFile, File diffEntryFile) throws FileNotFoundException, IOException {
|
||||||
@@ -115,22 +116,25 @@ public class Parser {
|
|||||||
actionSet.setStartLineNum(startLineNum);
|
actionSet.setStartLineNum(startLineNum);
|
||||||
actionSet.setEndLineNum(endLineNum);
|
actionSet.setEndLineNum(endLineNum);
|
||||||
|
|
||||||
// Source Code of patches.
|
/*
|
||||||
String patchSourceCode = getPatchSourceCode(sourceCode, startLineNum, endLineNum, startLineNum2,
|
|
||||||
endLineNum2);
|
|
||||||
if (patchSourceCode != null) {
|
|
||||||
patchesSourceCode += "PATCH###Num\n" + patchSourceCode;
|
|
||||||
patchesSourceCode += actionSet.toString() + "\n";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert the ITree of buggy code to a simple tree.
|
* Convert the ITree of buggy code to a simple tree.
|
||||||
* TODO: it will be used to compute the similarity.
|
* It will be used to compute the similarity.
|
||||||
*/
|
*/
|
||||||
SimplifyTree abstractIdentifier = new SimplifyTree();
|
SimplifyTree abstractIdentifier = new SimplifyTree();
|
||||||
abstractIdentifier.abstractTree(actionSet);
|
abstractIdentifier.abstractTree(actionSet);
|
||||||
SimpleTree simpleTree = actionSet.getSimpleTree();
|
SimpleTree simpleTree = actionSet.getSimpleTree();
|
||||||
SimpleTree abstractSimpleTree = actionSet.getAbstractSimpleTree();
|
|
||||||
clearITree(actionSet);
|
clearITree(actionSet);
|
||||||
|
if (simpleTree == null) { // Failed to get the simple tree for INS actions.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
this.buggyTrees += "BUGGY_TREE###\n" + simpleTree.toString() + "\n";
|
||||||
|
|
||||||
|
// Source Code of patches.
|
||||||
|
String patchSourceCode = getPatchSourceCode(sourceCode, startLineNum, endLineNum, startLineNum2,
|
||||||
|
endLineNum2);
|
||||||
|
if (patchSourceCode == null) continue;
|
||||||
|
patchesSourceCode += "PATCH###\n" + patchSourceCode;
|
||||||
|
patchesSourceCode += actionSet.toString() + "\n";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select edit scripts for deep learning.
|
* Select edit scripts for deep learning.
|
||||||
@@ -153,7 +157,6 @@ public class Parser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private String getSemiSourceCodeEditScripts(HierarchicalActionSet actionSet) {
|
private String getSemiSourceCodeEditScripts(HierarchicalActionSet actionSet) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
@@ -364,4 +367,8 @@ public class Parser {
|
|||||||
return maxSize;
|
return maxSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getBuggyTrees() {
|
||||||
|
return buggyTrees;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user