FIX: from pure action set to ALL

This commit is contained in:
fixminer
2018-09-09 11:59:17 +02:00
parent 3d678eebb6
commit bf19c4c02f
5 changed files with 33 additions and 32 deletions
@@ -44,27 +44,27 @@ public class FixedViolationHunkParser extends FixedViolationParser {
public void parseFixPatterns(File prevFile, File revFile, File diffentryFile,String project) {
List<HierarchicalActionSet> actionSets = parseChangedSourceCodeWithGumTree2(prevFile, revFile);
if (actionSets.size() != 0) {
boolean isUpdate =
actionSets.stream().allMatch(p -> p.getAction() instanceof Update);
boolean isInsert =
actionSets.stream().allMatch(p -> p.getAction() instanceof Insert);
boolean isDelete =
actionSets.stream().allMatch(p -> p.getAction() instanceof Delete);
boolean isMove =
actionSets.stream().allMatch(p -> p.getAction() instanceof Move);
// boolean isUpdate =
// actionSets.stream().allMatch(p -> p.getAction() instanceof Update);
// boolean isInsert =
// actionSets.stream().allMatch(p -> p.getAction() instanceof Insert);
// boolean isDelete =
// actionSets.stream().allMatch(p -> p.getAction() instanceof Delete);
// boolean isMove =
// actionSets.stream().allMatch(p -> p.getAction() instanceof Move);
int hunkSet = 0;
if (isUpdate || isInsert || isDelete || isMove) {
// if (isUpdate || isInsert || isDelete || isMove) {
for (HierarchicalActionSet actionSet : actionSets) {
String folder = null;
if (isUpdate) {
folder = "/UPD/";
} else if (isDelete) {
folder = "/DEL/";
} else if (isInsert) {
folder = "/INS/";
} else if (isMove) {
folder = "/MOV/";
}
String folder = "/ALL/";
// if (isUpdate) {
// folder = "/UPD/";
// } else if (isDelete) {
// folder = "/DEL/";
// } else if (isInsert) {
// folder = "/INS/";
// } else if (isMove) {
// folder = "/MOV/";
// }
FileOutputStream f = null;
@@ -91,7 +91,7 @@ public class FixedViolationHunkParser extends FixedViolationParser {
hunkSet++;
}
}
// }
}
}
@@ -230,7 +230,7 @@ public class MultiThreadTreeLoaderCluster3 {
}
private static List<String> getNames(ITree oldTree, List<String> oldTokens){
public static List<String> getNames(ITree oldTree, List<String> oldTokens){
List<ITree> descendants = oldTree.getDescendants();
descendants.add(0,oldTree);
@@ -75,6 +75,7 @@ public class TestHunkParser {
try {
log.info("Akka begins...");
system = ActorSystem.create("Mining-FixPattern-System");
System.out.println(system.settings());
parsingActor = system.actorOf(ParseFixPatternActor.props(Integer.valueOf(numOfWorkers), project), "mine-fix-pattern-actor");
parsingActor.tell(msg, ActorRef.noSender());
} catch (Exception e) {
@@ -112,13 +112,13 @@ public class Launcher {
}
private static void level1(String portInner, String serverWait, String port, String pythonPath, String datasetPath, String pjName, String actionType, String threshold, String dbDir, String pairsPath, String dumpsName, String gumInput) throws Exception {
CalculatePairs.main(serverWait, dbDir, actionType+dumpsName, portInner, pairsPath+actionType, pjName+actionType);
ImportPairs2DB.main(pairsPath+actionType, portInner, serverWait, dbDir,datasetPath);
AkkaTreeLoader.main(portInner, serverWait, dbDir, pjName +actionType+".csv.rdb" , port, actionType+dumpsName);
TreeLoaderClusterL1.main(portInner, serverWait, port, dbDir, "level1-"+pjName+ actionType+".rdb", dbDir ,pjName + actionType);
// CalculatePairs.main(serverWait, dbDir, actionType+dumpsName, portInner, pairsPath+actionType, pjName+actionType);
//
// ImportPairs2DB.main(pairsPath+actionType, portInner, serverWait, dbDir,datasetPath);
//
// AkkaTreeLoader.main(portInner, serverWait, dbDir, pjName +actionType+".csv.rdb" , port, actionType+dumpsName);
//
// TreeLoaderClusterL1.main(portInner, serverWait, port, dbDir, "level1-"+pjName+ actionType+".rdb", dbDir ,pjName + actionType);
CallShell cs1 =new CallShell();
String db1 = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
@@ -100,8 +100,8 @@ public class PatternExtractor {
String clusterPath = "/Users/anilkoyuncu/bugStudy/release/dataset/output/clusterallDatasetUPD/";
String savePath = "/Users/anilkoyuncu/bugStudy/release/dataset/dumps/";
String clusterPath = "/Users/anilkoyuncu/bugStudy/release/code/clusterallDataset"+operation+"/";
String savePath = "/Users/anilkoyuncu/bugStudy/release/dataset/dumps"+operation+"/";
File patternsF = new File(clusterPath);
File[] listOfPatterns = patternsF.listFiles();
Stream<File> patterns = Arrays.stream(listOfPatterns);
@@ -177,8 +177,8 @@ public class PatternExtractor {
public static void getPattern(List<String> fixes,String operation){
String clusterPath = "/Users/anilkoyuncu/bugStudy/release/dataset/output/clusterallDatasetUPD/";
String savePath = "/Users/anilkoyuncu/bugStudy/release/dataset/dumps/";
// String savePath = "/Users/anilkoyuncu/bugStudy/release/dataset/dumps/";
String savePath = "/Volumes/anil.koyuncu/dumps/";
File patternsF = new File(clusterPath);
File[] listOfPatterns = patternsF.listFiles();
Stream<File> patterns = Arrays.stream(listOfPatterns);