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) { public void parseFixPatterns(File prevFile, File revFile, File diffentryFile,String project) {
List<HierarchicalActionSet> actionSets = parseChangedSourceCodeWithGumTree2(prevFile, revFile); List<HierarchicalActionSet> actionSets = parseChangedSourceCodeWithGumTree2(prevFile, revFile);
if (actionSets.size() != 0) { if (actionSets.size() != 0) {
boolean isUpdate = // boolean isUpdate =
actionSets.stream().allMatch(p -> p.getAction() instanceof Update); // actionSets.stream().allMatch(p -> p.getAction() instanceof Update);
boolean isInsert = // boolean isInsert =
actionSets.stream().allMatch(p -> p.getAction() instanceof Insert); // actionSets.stream().allMatch(p -> p.getAction() instanceof Insert);
boolean isDelete = // boolean isDelete =
actionSets.stream().allMatch(p -> p.getAction() instanceof Delete); // actionSets.stream().allMatch(p -> p.getAction() instanceof Delete);
boolean isMove = // boolean isMove =
actionSets.stream().allMatch(p -> p.getAction() instanceof Move); // actionSets.stream().allMatch(p -> p.getAction() instanceof Move);
int hunkSet = 0; int hunkSet = 0;
if (isUpdate || isInsert || isDelete || isMove) { // if (isUpdate || isInsert || isDelete || isMove) {
for (HierarchicalActionSet actionSet : actionSets) { for (HierarchicalActionSet actionSet : actionSets) {
String folder = null; String folder = "/ALL/";
if (isUpdate) { // if (isUpdate) {
folder = "/UPD/"; // folder = "/UPD/";
} else if (isDelete) { // } else if (isDelete) {
folder = "/DEL/"; // folder = "/DEL/";
} else if (isInsert) { // } else if (isInsert) {
folder = "/INS/"; // folder = "/INS/";
} else if (isMove) { // } else if (isMove) {
folder = "/MOV/"; // folder = "/MOV/";
} // }
FileOutputStream f = null; FileOutputStream f = null;
@@ -91,7 +91,7 @@ public class FixedViolationHunkParser extends FixedViolationParser {
hunkSet++; 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(); List<ITree> descendants = oldTree.getDescendants();
descendants.add(0,oldTree); descendants.add(0,oldTree);
@@ -75,6 +75,7 @@ public class TestHunkParser {
try { try {
log.info("Akka begins..."); log.info("Akka begins...");
system = ActorSystem.create("Mining-FixPattern-System"); 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 = system.actorOf(ParseFixPatternActor.props(Integer.valueOf(numOfWorkers), project), "mine-fix-pattern-actor");
parsingActor.tell(msg, ActorRef.noSender()); parsingActor.tell(msg, ActorRef.noSender());
} catch (Exception e) { } 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 { 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); // CalculatePairs.main(serverWait, dbDir, actionType+dumpsName, portInner, pairsPath+actionType, pjName+actionType);
//
ImportPairs2DB.main(pairsPath+actionType, portInner, serverWait, dbDir,datasetPath); // ImportPairs2DB.main(pairsPath+actionType, portInner, serverWait, dbDir,datasetPath);
//
AkkaTreeLoader.main(portInner, serverWait, dbDir, pjName +actionType+".csv.rdb" , port, actionType+dumpsName); // 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); // TreeLoaderClusterL1.main(portInner, serverWait, port, dbDir, "level1-"+pjName+ actionType+".rdb", dbDir ,pjName + actionType);
CallShell cs1 =new CallShell(); CallShell cs1 =new CallShell();
String db1 = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s"; 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 clusterPath = "/Users/anilkoyuncu/bugStudy/release/code/clusterallDataset"+operation+"/";
String savePath = "/Users/anilkoyuncu/bugStudy/release/dataset/dumps/"; String savePath = "/Users/anilkoyuncu/bugStudy/release/dataset/dumps"+operation+"/";
File patternsF = new File(clusterPath); File patternsF = new File(clusterPath);
File[] listOfPatterns = patternsF.listFiles(); File[] listOfPatterns = patternsF.listFiles();
Stream<File> patterns = Arrays.stream(listOfPatterns); Stream<File> patterns = Arrays.stream(listOfPatterns);
@@ -177,8 +177,8 @@ public class PatternExtractor {
public static void getPattern(List<String> fixes,String operation){ public static void getPattern(List<String> fixes,String operation){
String clusterPath = "/Users/anilkoyuncu/bugStudy/release/dataset/output/clusterallDatasetUPD/"; 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 patternsF = new File(clusterPath);
File[] listOfPatterns = patternsF.listFiles(); File[] listOfPatterns = patternsF.listFiles();
Stream<File> patterns = Arrays.stream(listOfPatterns); Stream<File> patterns = Arrays.stream(listOfPatterns);