ase submitted

This commit is contained in:
Anil Koyuncu
2018-04-27 15:25:28 +02:00
parent e8df96a398
commit 931ce5c04f
4 changed files with 48 additions and 35 deletions
@@ -253,7 +253,7 @@ public class AkkaTreeLoader {
ITree children =null; ITree children =null;
TreeContext tc = new TreeContext(); TreeContext tc = new TreeContext();
tree = getASTTree(actionSet, parent, children,tc); tree = getASTTree(actionSet, parent, children,tc);
tree.setParent(null); // tree.setParent(null);
tc.validate(); tc.validate();
} catch (IOException e) { } catch (IOException e) {
@@ -396,7 +396,8 @@ public class MultiThreadTreeLoaderCluster3 {
(sType.equals("43") && oldDescendant.getHeight() == 0 && oldDescendant.getChildren().size() == 0) || (sType.equals("43") && oldDescendant.getHeight() == 0 && oldDescendant.getChildren().size() == 0) ||
(sType.equals("53") )|| //&& oldDescendant.getHeight() == 1 && oldDescendant.getChildren().size() == 1) || (sType.equals("53") )|| //&& oldDescendant.getHeight() == 1 && oldDescendant.getChildren().size() == 1) ||
(sType.equals("7") && oldDescendant.getHeight() == 1 && oldDescendant.getChildren().size() == 1) || (sType.equals("7") && oldDescendant.getHeight() == 1 && oldDescendant.getChildren().size() == 1) ||
(sType.equals("41") && oldDescendant.getHeight() == 1 && oldDescendant.getChildren().size() == 1) (sType.equals("41") && oldDescendant.getHeight() == 1 && oldDescendant.getChildren().size() == 1) ||
(sType.equals("40") && oldDescendant.getHeight() == 1 && oldDescendant.getChildren().size() == 1)
){ ){
// int depth = oldDescendant.getChildren().size(); // int depth = oldDescendant.getChildren().size();
@@ -476,6 +477,12 @@ public class MultiThreadTreeLoaderCluster3 {
m.add(hours.trim()); m.add(hours.trim());
m.add(to.trim()); m.add(to.trim());
addToken = true; addToken = true;
}else if(sType.equals("40") && oldDescendant.getChildren().size()==1 && oldDescendant.getHeight()==1 ){//qualified name
m.add(hours.trim());
m.add(to.trim());
addToken = true;
}else if(sType.equals("-1") && oldDescendant.getChildren().size()==0 && oldDescendant.getHeight()==0 ){//operator }else if(sType.equals("-1") && oldDescendant.getChildren().size()==0 && oldDescendant.getHeight()==0 ){//operator
m.add(hours.trim()); m.add(hours.trim());
m.add(to.trim()); m.add(to.trim());
@@ -484,6 +491,10 @@ public class MultiThreadTreeLoaderCluster3 {
m.add(hours.trim()); m.add(hours.trim());
m.add(to.trim()); m.add(to.trim());
addToken = true; addToken = true;
}else if(sType.equals("39") && oldDescendant.getChildren().size()==0 && oldDescendant.getHeight()==0 ){//primitive type
m.add(hours.trim());
m.add(to.trim());
addToken = true;
}else{ }else{
m.add(hours.trim()); m.add(hours.trim());
m.add(to.trim()); m.add(to.trim());
@@ -497,9 +508,11 @@ public class MultiThreadTreeLoaderCluster3 {
if (matcher.matches()) { if (matcher.matches()) {
String hours = matcher.group(1); String hours = matcher.group(1);
if (hours.startsWith("MethodName:")){ if (hours.startsWith("MethodName:")) {
String methodName = hours.split(":")[1]; String methodName = hours.split(":")[1];
oldTokens.add(methodName); oldTokens.add(methodName);
// }else if(sType.equals("34")){
// oldTokens.add("NumberLiteral");
}else { }else {
oldTokens.add(hours.trim()); oldTokens.add(hours.trim());
} }
@@ -547,21 +560,21 @@ public class MultiThreadTreeLoaderCluster3 {
String methodName = s.split(":")[1]; String methodName = s.split(":")[1];
ITree parent = oldDescendant.getParent(); ITree parent = oldDescendant.getParent();
if(parent!= null && parent.getType() == 32 && !alreadyAddParentMethodName){ //parent is method invocation statement // if(parent!= null && parent.getType() == 32 && !alreadyAddParentMethodName){ //parent is method invocation statement
String parentLabel = parent.getLabel(); // String parentLabel = parent.getLabel();
String[] pns = parentLabel.split("\\." + methodName); // String[] pns = parentLabel.split("\\." + methodName);
if(pns.length > 1) { // if(pns.length > 1) {
String parentName = pns[0]; // String parentName = pns[0];
String[] parentNameSplit = parentName.split("@@"); // String[] parentNameSplit = parentName.split("@@");
if (parentNameSplit.length > 1) { // if (parentNameSplit.length > 1) {
String parentMethodName = parentNameSplit[1]; // String parentMethodName = parentNameSplit[1];
String s1 = parentMethodName.split("@TO@")[0]; // String s1 = parentMethodName.split("@TO@")[0];
oldTokens.add(s1.trim()); // oldTokens.add(s1.trim());
alreadyAddParentMethodName = true; // alreadyAddParentMethodName = true;
} // }
} // }
//
} // }
oldTokens.add(methodName); oldTokens.add(methodName);
}else if( sType.equals("59") || sType.equals("43")|| sType.equals("53") || sType.equals("7") || sType.equals("27") || sType.equals("83") || sType.equals("44") ||sType.equals("78") || sType.equals("41") || addToken){ }else if( sType.equals("59") || sType.equals("43")|| sType.equals("53") || sType.equals("7") || sType.equals("27") || sType.equals("83") || sType.equals("44") ||sType.equals("78") || sType.equals("41") || addToken){
// if(sType.equals("27") || sType.equals("83") || sType.equals("44")){ // if(sType.equals("27") || sType.equals("83") || sType.equals("44")){
@@ -32,7 +32,7 @@ public class TestHunkParserSingleFile {
outputPath = args[0]; outputPath = args[0];
}else{ }else{
// inputPath = "/Users/anilkoyuncu/bugStudy/dataset/GumTreeInputBug4"; // inputPath = "/Users/anilkoyuncu/bugStudy/dataset/GumTreeInputBug4";
inputPath = "/Volumes/data/bugStudy_backup/dataset/GumTreeInputBug4"; inputPath = "/Users/anilkoyuncu/bugStudy/dataset/allDataset";
// outputPath = "/Users/anilkoyuncu/bugStudy/code/python/GumTreeOutput2/"; // outputPath = "/Users/anilkoyuncu/bugStudy/code/python/GumTreeOutput2/";
outputPath = "/Users/anilkoyuncu/bugStudy/dataset/GumTreeOutputSingle"; outputPath = "/Users/anilkoyuncu/bugStudy/dataset/GumTreeOutputSingle";
} }
@@ -59,9 +59,9 @@ public class TestHunkParserSingleFile {
// List<String> pjList = Arrays.asList("DATAJPA","ZXing","PDE","SWS","SWT", "SWF", "COLLECTIONS", "JDT"); // List<String> pjList = Arrays.asList("DATAJPA","ZXing","PDE","SWS","SWT", "SWF", "COLLECTIONS", "JDT");
List<String> files = new ArrayList<String>(); List<String> files = new ArrayList<String>();
// files.add("5d9d60_76f5be_components#camel-jaxb#src#test#java#org#apache#camel#jaxb#FallbackTypeConverterShouldNotThrowExceptionTest.java"); // files.add("5d9d60_76f5be_components#camel-jaxb#src#test#java#org#apache#camel#jaxb#FallbackTypeConverterShouldNotThrowExceptionTest.java");
files.add("49821e_3cc787_components#camel-infinispan#src#main#java#org#apache#camel#component#infinispan#InfinispanConstants.java"); files.add("d6c5e5_9f96d9_hbase-server#src#main#java#org#apache#hadoop#hbase#master#RegionStates.java");
for(String f : files){ for(String f : files){
String pjName = "CAMEL"; String pjName = "HBASE";
// for (File target : folders) { // for (File target : folders) {
// String pjName = target.getName(); // String pjName = target.getName();
// if (!pjList.contains(pjName)){ // if (!pjList.contains(pjName)){
+14 -14
View File
@@ -66,7 +66,7 @@ public class Launcher {
datasetPath = "/Users/anilkoyuncu/bugStudy/dataset"; datasetPath = "/Users/anilkoyuncu/bugStudy/dataset";
pjName = "allDataset"; pjName = "allDataset";
dbNo = "0"; dbNo = "0";
actionType ="DEL"; actionType ="UPD";
} }
gumInput = datasetPath +"/"+pjName+"/"; gumInput = datasetPath +"/"+pjName+"/";
gumOutput = datasetPath + "/GumTreeOutput" + pjName; gumOutput = datasetPath + "/GumTreeOutput" + pjName;
@@ -301,19 +301,19 @@ public class Launcher {
stopServer = String.format(stopServera,Integer.valueOf(port)); stopServer = String.format(stopServera,Integer.valueOf(port));
cs5.runShell(stopServer,serverWait); cs5.runShell(stopServer,serverWait);
String dbc = String.format(dba, dbDir,"clusterl2-"+pjName+"DEL.rdb",Integer.valueOf(port)); // String dbc = String.format(dba, dbDir,"clusterl2-"+pjName+"DEL.rdb",Integer.valueOf(port));
cs5.runShell(dbc,serverWait); // cs5.runShell(dbc,serverWait);
String formatRunPyc = String.format(runpya,pythonPath +"/abstractPatchClusterLevel3.py", gumInput, datasetPath + "/cluster-3l"+pjName+ "DEL", port, datasetPath + "/cluster-2l"+pjName+ "DEL"); // String formatRunPyc = String.format(runpya,pythonPath +"/abstractPatchClusterLevel3.py", gumInput, datasetPath + "/cluster-3l"+pjName+ "DEL", port, datasetPath + "/cluster-2l"+pjName+ "DEL");
cs5.runShell(formatRunPyc); // cs5.runShell(formatRunPyc);
stopServer = String.format(stopServera,Integer.valueOf(port)); // stopServer = String.format(stopServera,Integer.valueOf(port));
cs5.runShell(stopServer,serverWait); // cs5.runShell(stopServer,serverWait);
////
String dbd = String.format(dba, dbDir,"clusterl2-"+pjName+"MOV.rdb",Integer.valueOf(port)); // String dbd = String.format(dba, dbDir,"clusterl2-"+pjName+"MOV.rdb",Integer.valueOf(port));
cs5.runShell(dbd,serverWait); // cs5.runShell(dbd,serverWait);
String formatRunPyd = String.format(runpya,pythonPath +"/abstractPatchClusterLevel3.py", gumInput, datasetPath + "/cluster-3l"+pjName+ "MOV", port, datasetPath + "/cluster-2l"+pjName+ "MOV"); // String formatRunPyd = String.format(runpya,pythonPath +"/abstractPatchClusterLevel3.py", gumInput, datasetPath + "/cluster-3l"+pjName+ "MOV", port, datasetPath + "/cluster-2l"+pjName+ "MOV");
cs5.runShell(formatRunPyd); // cs5.runShell(formatRunPyd);
stopServer = String.format(stopServera,Integer.valueOf(port)); // stopServer = String.format(stopServera,Integer.valueOf(port));
cs5.runShell(stopServer,serverWait); // cs5.runShell(stopServer,serverWait);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();