rc 3
This commit is contained in:
@@ -1,55 +0,0 @@
|
|||||||
package edu.lu.uni.serval.FixPatternParser;
|
|
||||||
|
|
||||||
import org.eclipse.jdt.core.dom.AST;
|
|
||||||
import org.eclipse.jdt.core.dom.ASTParser;
|
|
||||||
import org.eclipse.jdt.core.dom.CompilationUnit;
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creator of a CompilationUnit.
|
|
||||||
*
|
|
||||||
* @author kui.liu
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class CUCreator {
|
|
||||||
|
|
||||||
public CompilationUnit createCompilationUnit(File javaFile) {
|
|
||||||
CompilationUnit unit = null;
|
|
||||||
try {
|
|
||||||
char[] sourceCode = readFileToCharArray(new FileReader(javaFile));
|
|
||||||
ASTParser parser = createASTParser(sourceCode);
|
|
||||||
parser.setKind(ASTParser.K_COMPILATION_UNIT);
|
|
||||||
unit = (CompilationUnit) parser.createAST(null);
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ASTParser createASTParser(char[] javaCode) {
|
|
||||||
ASTParser parser = ASTParser.newParser(AST.JLS8);
|
|
||||||
parser.setSource(javaCode);
|
|
||||||
|
|
||||||
return parser;
|
|
||||||
}
|
|
||||||
|
|
||||||
private char[] readFileToCharArray(FileReader fileReader) throws IOException {
|
|
||||||
StringBuilder fileData = new StringBuilder();
|
|
||||||
BufferedReader br = new BufferedReader(fileReader);
|
|
||||||
|
|
||||||
char[] buf = new char[10];
|
|
||||||
int numRead = 0;
|
|
||||||
while ((numRead = br.read(buf)) != -1) {
|
|
||||||
String readData = String.valueOf(buf, 0, numRead);
|
|
||||||
fileData.append(readData);
|
|
||||||
buf = new char[1024];
|
|
||||||
}
|
|
||||||
br.close();
|
|
||||||
|
|
||||||
return fileData.toString().toCharArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+2
-4
@@ -1,6 +1,4 @@
|
|||||||
package edu.lu.uni.serval.FixPatternParser.violations;
|
package edu.lu.uni.serval.FixPatternParser;
|
||||||
|
|
||||||
import edu.lu.uni.serval.gumtree.regroup.HierarchicalActionSet;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -13,7 +11,7 @@ import java.util.List;
|
|||||||
* @author kui.liu
|
* @author kui.liu
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class FixedViolationHunkParser extends FixedViolationParser {
|
public class FixedPatternHunkParser extends FixedPatternParser {
|
||||||
|
|
||||||
public String testingInfo = "";
|
public String testingInfo = "";
|
||||||
|
|
||||||
+2
-5
@@ -1,10 +1,7 @@
|
|||||||
package edu.lu.uni.serval.FixPatternParser.violations;
|
package edu.lu.uni.serval.FixPatternParser;
|
||||||
|
|
||||||
import com.github.gumtreediff.actions.model.Action;
|
import com.github.gumtreediff.actions.model.Action;
|
||||||
import edu.lu.uni.serval.FixPatternParser.Parser;
|
|
||||||
import edu.lu.uni.serval.gumtree.GumTreeComparer;
|
import edu.lu.uni.serval.gumtree.GumTreeComparer;
|
||||||
import edu.lu.uni.serval.gumtree.regroup.HierarchicalActionSet;
|
|
||||||
import edu.lu.uni.serval.gumtree.regroup.HierarchicalRegrouper;
|
|
||||||
import edu.lu.uni.serval.utils.ListSorter;
|
import edu.lu.uni.serval.utils.ListSorter;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -17,7 +14,7 @@ import java.util.List;
|
|||||||
* @author kui.liu
|
* @author kui.liu
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class FixedViolationParser extends Parser {
|
public class FixedPatternParser extends Parser {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ResultType:
|
* ResultType:
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package edu.lu.uni.serval.gumtree.regroup;
|
package edu.lu.uni.serval.FixPatternParser;
|
||||||
|
|
||||||
import com.github.gumtreediff.actions.model.Action;
|
import com.github.gumtreediff.actions.model.Action;
|
||||||
import com.github.gumtreediff.tree.ITree;
|
import com.github.gumtreediff.tree.ITree;
|
||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
package edu.lu.uni.serval.gumtree.regroup;
|
package edu.lu.uni.serval.FixPatternParser;
|
||||||
|
|
||||||
import com.github.gumtreediff.actions.model.*;
|
import com.github.gumtreediff.actions.model.*;
|
||||||
import com.github.gumtreediff.tree.ITree;
|
import com.github.gumtreediff.tree.ITree;
|
||||||
import edu.lu.uni.serval.FixPattern.utils.ASTNodeMap;
|
import edu.lu.uni.serval.utils.ASTNodeMap;
|
||||||
import edu.lu.uni.serval.utils.ListSorter;
|
import edu.lu.uni.serval.utils.ListSorter;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package edu.lu.uni.serval.fixminer;
|
package edu.lu.uni.serval.fixminer;
|
||||||
|
|
||||||
import edu.lu.uni.serval.fixminer.cluster.*;
|
import edu.lu.uni.serval.fixminer.jobs.*;
|
||||||
|
import edu.lu.uni.serval.utils.CallShell;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
package edu.lu.uni.serval.fixminer.cluster;
|
package edu.lu.uni.serval.fixminer;
|
||||||
|
|
||||||
import com.github.gumtreediff.actions.ActionGenerator;
|
import com.github.gumtreediff.actions.ActionGenerator;
|
||||||
import com.github.gumtreediff.actions.model.Action;
|
import com.github.gumtreediff.actions.model.Action;
|
||||||
@@ -6,8 +6,8 @@ import com.github.gumtreediff.matchers.Matcher;
|
|||||||
import com.github.gumtreediff.matchers.Matchers;
|
import com.github.gumtreediff.matchers.Matchers;
|
||||||
import com.github.gumtreediff.tree.ITree;
|
import com.github.gumtreediff.tree.ITree;
|
||||||
import com.github.gumtreediff.tree.Tree;
|
import com.github.gumtreediff.tree.Tree;
|
||||||
import edu.lu.uni.serval.FixPattern.utils.ASTNodeMap;
|
import edu.lu.uni.serval.utils.ASTNodeMap;
|
||||||
import edu.lu.uni.serval.gumtree.regroup.HierarchicalActionSet;
|
import edu.lu.uni.serval.FixPatternParser.HierarchicalActionSet;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import redis.clients.jedis.*;
|
import redis.clients.jedis.*;
|
||||||
@@ -2,9 +2,9 @@ package edu.lu.uni.serval.fixminer;
|
|||||||
|
|
||||||
import akka.actor.ActorRef;
|
import akka.actor.ActorRef;
|
||||||
import akka.actor.ActorSystem;
|
import akka.actor.ActorSystem;
|
||||||
import edu.lu.uni.serval.MultipleThreadsParser.MessageFile;
|
import edu.lu.uni.serval.fixminer.cluster.akka.MessageFile;
|
||||||
import edu.lu.uni.serval.MultipleThreadsParser.ParseFixPatternActor;
|
import edu.lu.uni.serval.fixminer.cluster.akka.EDiffActor;
|
||||||
import edu.lu.uni.serval.MultipleThreadsParser.WorkMessage;
|
import edu.lu.uni.serval.fixminer.cluster.akka.EDiffMessage;
|
||||||
import edu.lu.uni.serval.utils.FileHelper;
|
import edu.lu.uni.serval.utils.FileHelper;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -96,11 +96,11 @@ public class TestHunkParserSingleFile {
|
|||||||
|
|
||||||
ActorSystem system = null;
|
ActorSystem system = null;
|
||||||
ActorRef parsingActor = null;
|
ActorRef parsingActor = null;
|
||||||
final WorkMessage msg = new WorkMessage(0, msgFiles);
|
final EDiffMessage msg = new EDiffMessage(0, msgFiles);
|
||||||
try {
|
try {
|
||||||
log.info("Akka begins...");
|
log.info("Akka begins...");
|
||||||
system = ActorSystem.create("Mining-FixPattern-System");
|
system = ActorSystem.create("Mining-FixPattern-System");
|
||||||
parsingActor = system.actorOf(ParseFixPatternActor.props(1, "dataset"), "mine-fix-pattern-actor");
|
parsingActor = system.actorOf(EDiffActor.props(1, "dataset"), "mine-fix-pattern-actor");
|
||||||
parsingActor.tell(msg, ActorRef.noSender());
|
parsingActor.tell(msg, ActorRef.noSender());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
system.shutdown();
|
system.shutdown();
|
||||||
@@ -109,7 +109,7 @@ public class TestHunkParserSingleFile {
|
|||||||
|
|
||||||
// int counter = 0;
|
// int counter = 0;
|
||||||
// for (MessageFile msgFile : msgFiles) {
|
// for (MessageFile msgFile : msgFiles) {
|
||||||
// FixedViolationHunkParser parser = new FixedViolationHunkParser();
|
// FixedPatternHunkParser parser = new FixedPatternHunkParser();
|
||||||
//
|
//
|
||||||
// final ExecutorService executor = Executors.newSingleThreadExecutor();
|
// final ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||||
// // schedule the work
|
// // schedule the work
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import com.github.gumtreediff.actions.model.Action;
|
|||||||
import com.github.gumtreediff.matchers.Matcher;
|
import com.github.gumtreediff.matchers.Matcher;
|
||||||
import com.github.gumtreediff.matchers.Matchers;
|
import com.github.gumtreediff.matchers.Matchers;
|
||||||
import com.github.gumtreediff.tree.ITree;
|
import com.github.gumtreediff.tree.ITree;
|
||||||
import edu.lu.uni.serval.FixPattern.utils.EDiff;
|
import edu.lu.uni.serval.utils.EDiff;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import redis.clients.jedis.Jedis;
|
import redis.clients.jedis.Jedis;
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
package edu.lu.uni.serval.fixminer.cluster;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class WorkMessage {
|
|
||||||
|
|
||||||
private int id;
|
|
||||||
private List<String> msgFiles;
|
|
||||||
|
|
||||||
public String getDbDir() {
|
|
||||||
return dbDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getServerWait() {
|
|
||||||
return serverWait;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String dbDir;
|
|
||||||
private String serverWait;
|
|
||||||
|
|
||||||
public String getInputPath() {
|
|
||||||
return inputPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String inputPath;
|
|
||||||
|
|
||||||
public String getInnerPort() {
|
|
||||||
return innerPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String innerPort;
|
|
||||||
|
|
||||||
public WorkMessage(int id, List<String> msgFiles,String innerPort,String inputPath,String dbDir,String serverWait) {
|
|
||||||
super();
|
|
||||||
this.id = id;
|
|
||||||
this.msgFiles = msgFiles;
|
|
||||||
this.innerPort = innerPort;
|
|
||||||
this.inputPath = inputPath;
|
|
||||||
this.dbDir = dbDir;
|
|
||||||
this.serverWait = serverWait;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getMsgFiles() {
|
|
||||||
return msgFiles;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,6 @@ package edu.lu.uni.serval.fixminer.cluster.akka;
|
|||||||
|
|
||||||
import akka.actor.ActorRef;
|
import akka.actor.ActorRef;
|
||||||
import akka.actor.ActorSystem;
|
import akka.actor.ActorSystem;
|
||||||
import edu.lu.uni.serval.fixminer.cluster.TreeActor;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import redis.clients.jedis.Jedis;
|
import redis.clients.jedis.Jedis;
|
||||||
|
|||||||
+11
-11
@@ -1,4 +1,4 @@
|
|||||||
package edu.lu.uni.serval.MultipleThreadsParser;
|
package edu.lu.uni.serval.fixminer.cluster.akka;
|
||||||
|
|
||||||
import akka.actor.ActorRef;
|
import akka.actor.ActorRef;
|
||||||
import akka.actor.Props;
|
import akka.actor.Props;
|
||||||
@@ -10,29 +10,29 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ParseFixPatternActor extends UntypedActor {
|
public class EDiffActor extends UntypedActor {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(ParseFixPatternActor.class);
|
private static Logger logger = LoggerFactory.getLogger(EDiffActor.class);
|
||||||
|
|
||||||
private ActorRef mineRouter;
|
private ActorRef mineRouter;
|
||||||
private final int numberOfWorkers;
|
private final int numberOfWorkers;
|
||||||
private int counter = 0;
|
private int counter = 0;
|
||||||
|
|
||||||
public ParseFixPatternActor(int numberOfWorkers, String project) {
|
public EDiffActor(int numberOfWorkers, String project) {
|
||||||
mineRouter = this.getContext().actorOf(new RoundRobinPool(numberOfWorkers)
|
mineRouter = this.getContext().actorOf(new RoundRobinPool(numberOfWorkers)
|
||||||
.props(ParseFixPatternWorker.props(project)), "mine-fix-pattern-router");
|
.props(EDiffWorker.props(project)), "mine-fix-pattern-router");
|
||||||
this.numberOfWorkers = numberOfWorkers;
|
this.numberOfWorkers = numberOfWorkers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Props props(final int numberOfWorkers, final String project) {
|
public static Props props(final int numberOfWorkers, final String project) {
|
||||||
|
|
||||||
return Props.create(new Creator<ParseFixPatternActor>() {
|
return Props.create(new Creator<EDiffActor>() {
|
||||||
|
|
||||||
private static final long serialVersionUID = 9207427376110704705L;
|
private static final long serialVersionUID = 9207427376110704705L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ParseFixPatternActor create() throws Exception {
|
public EDiffActor create() throws Exception {
|
||||||
return new ParseFixPatternActor(numberOfWorkers, project);
|
return new EDiffActor(numberOfWorkers, project);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -41,8 +41,8 @@ public class ParseFixPatternActor extends UntypedActor {
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Object message) throws Exception {
|
public void onReceive(Object message) throws Exception {
|
||||||
if (message instanceof WorkMessage) {
|
if (message instanceof EDiffMessage) {
|
||||||
List<MessageFile> files = ((WorkMessage) message).getMsgFiles();
|
List<MessageFile> files = ((EDiffMessage) message).getMsgFiles();
|
||||||
int size = files.size();
|
int size = files.size();
|
||||||
int average = size / numberOfWorkers;
|
int average = size / numberOfWorkers;
|
||||||
int reminder = size % numberOfWorkers;
|
int reminder = size % numberOfWorkers;
|
||||||
@@ -54,7 +54,7 @@ public class ParseFixPatternActor extends UntypedActor {
|
|||||||
int toIndex = (i + 1) * average + counter;
|
int toIndex = (i + 1) * average + counter;
|
||||||
|
|
||||||
List<MessageFile> filesOfWorkers = files.subList(fromIndex, toIndex);
|
List<MessageFile> filesOfWorkers = files.subList(fromIndex, toIndex);
|
||||||
final WorkMessage workMsg = new WorkMessage(i + 1, filesOfWorkers);
|
final EDiffMessage workMsg = new EDiffMessage(i + 1, filesOfWorkers);
|
||||||
mineRouter.tell(workMsg, getSelf());
|
mineRouter.tell(workMsg, getSelf());
|
||||||
logger.info("Assign a task to worker #" + (i + 1) + "...");
|
logger.info("Assign a task to worker #" + (i + 1) + "...");
|
||||||
}
|
}
|
||||||
+3
-3
@@ -1,13 +1,13 @@
|
|||||||
package edu.lu.uni.serval.MultipleThreadsParser;
|
package edu.lu.uni.serval.fixminer.cluster.akka;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class WorkMessage {
|
public class EDiffMessage {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
private List<MessageFile> msgFiles;
|
private List<MessageFile> msgFiles;
|
||||||
|
|
||||||
public WorkMessage(int id, List<MessageFile> msgFiles) {
|
public EDiffMessage(int id, List<MessageFile> msgFiles) {
|
||||||
super();
|
super();
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.msgFiles = msgFiles;
|
this.msgFiles = msgFiles;
|
||||||
+11
-11
@@ -1,10 +1,10 @@
|
|||||||
package edu.lu.uni.serval.MultipleThreadsParser;
|
package edu.lu.uni.serval.fixminer.cluster.akka;
|
||||||
|
|
||||||
import akka.actor.Props;
|
import akka.actor.Props;
|
||||||
import akka.actor.UntypedActor;
|
import akka.actor.UntypedActor;
|
||||||
import akka.japi.Creator;
|
import akka.japi.Creator;
|
||||||
|
import edu.lu.uni.serval.FixPatternParser.FixedPatternHunkParser;
|
||||||
import edu.lu.uni.serval.FixPatternParser.RunnableParser;
|
import edu.lu.uni.serval.FixPatternParser.RunnableParser;
|
||||||
import edu.lu.uni.serval.FixPatternParser.violations.FixedViolationHunkParser;
|
|
||||||
import edu.lu.uni.serval.config.Configuration;
|
import edu.lu.uni.serval.config.Configuration;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -13,24 +13,24 @@ import java.io.File;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.*;
|
||||||
|
|
||||||
public class ParseFixPatternWorker extends UntypedActor {
|
public class EDiffWorker extends UntypedActor {
|
||||||
private static Logger log = LoggerFactory.getLogger(ParseFixPatternActor.class);
|
private static Logger log = LoggerFactory.getLogger(EDiffActor.class);
|
||||||
|
|
||||||
private String project;
|
private String project;
|
||||||
|
|
||||||
|
|
||||||
public ParseFixPatternWorker(String project) {
|
public EDiffWorker(String project) {
|
||||||
this.project = project;
|
this.project = project;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Props props(final String project) {
|
public static Props props(final String project) {
|
||||||
return Props.create(new Creator<ParseFixPatternWorker>() {
|
return Props.create(new Creator<EDiffWorker>() {
|
||||||
|
|
||||||
private static final long serialVersionUID = -7615153844097275009L;
|
private static final long serialVersionUID = -7615153844097275009L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ParseFixPatternWorker create() throws Exception {
|
public EDiffWorker create() throws Exception {
|
||||||
return new ParseFixPatternWorker(project);
|
return new EDiffWorker(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -38,8 +38,8 @@ public class ParseFixPatternWorker extends UntypedActor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Object message) throws Exception {
|
public void onReceive(Object message) throws Exception {
|
||||||
if (message instanceof WorkMessage) {
|
if (message instanceof EDiffMessage) {
|
||||||
WorkMessage msg = (WorkMessage) message;
|
EDiffMessage msg = (EDiffMessage) message;
|
||||||
List<MessageFile> files = msg.getMsgFiles();
|
List<MessageFile> files = msg.getMsgFiles();
|
||||||
StringBuilder editScripts = new StringBuilder();
|
StringBuilder editScripts = new StringBuilder();
|
||||||
StringBuilder patchesSourceCode = new StringBuilder();
|
StringBuilder patchesSourceCode = new StringBuilder();
|
||||||
@@ -68,7 +68,7 @@ public class ParseFixPatternWorker extends UntypedActor {
|
|||||||
File diffentryFile = msgFile.getDiffEntryFile();
|
File diffentryFile = msgFile.getDiffEntryFile();
|
||||||
|
|
||||||
|
|
||||||
FixedViolationHunkParser parser = new FixedViolationHunkParser();
|
FixedPatternHunkParser parser = new FixedPatternHunkParser();
|
||||||
|
|
||||||
final ExecutorService executor = Executors.newSingleThreadExecutor();
|
final ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||||
// schedule the work
|
// schedule the work
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package edu.lu.uni.serval.MultipleThreadsParser;
|
package edu.lu.uni.serval.fixminer.cluster.akka;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
+1
-2
@@ -1,11 +1,10 @@
|
|||||||
package edu.lu.uni.serval.fixminer.cluster;
|
package edu.lu.uni.serval.fixminer.cluster.akka;
|
||||||
|
|
||||||
import akka.actor.ActorRef;
|
import akka.actor.ActorRef;
|
||||||
import akka.actor.Props;
|
import akka.actor.Props;
|
||||||
import akka.actor.UntypedActor;
|
import akka.actor.UntypedActor;
|
||||||
import akka.japi.Creator;
|
import akka.japi.Creator;
|
||||||
import akka.routing.RoundRobinPool;
|
import akka.routing.RoundRobinPool;
|
||||||
import edu.lu.uni.serval.fixminer.cluster.akka.TreeMessage;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import redis.clients.jedis.JedisPool;
|
import redis.clients.jedis.JedisPool;
|
||||||
+4
-3
@@ -1,10 +1,11 @@
|
|||||||
package edu.lu.uni.serval.fixminer.cluster;
|
package edu.lu.uni.serval.fixminer.cluster.akka;
|
||||||
|
|
||||||
import akka.actor.Props;
|
import akka.actor.Props;
|
||||||
import akka.actor.UntypedActor;
|
import akka.actor.UntypedActor;
|
||||||
import akka.japi.Creator;
|
import akka.japi.Creator;
|
||||||
import edu.lu.uni.serval.config.Configuration;
|
import edu.lu.uni.serval.config.Configuration;
|
||||||
import edu.lu.uni.serval.fixminer.cluster.akka.TreeMessage;
|
import edu.lu.uni.serval.fixminer.cluster.Compare;
|
||||||
|
import edu.lu.uni.serval.fixminer.cluster.RunnableCompare;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import redis.clients.jedis.JedisPool;
|
import redis.clients.jedis.JedisPool;
|
||||||
@@ -65,7 +66,7 @@ public class TreeWorker extends UntypedActor {
|
|||||||
if(message instanceof TreeMessage) {
|
if(message instanceof TreeMessage) {
|
||||||
|
|
||||||
|
|
||||||
// if (message instanceof edu.lu.uni.serval.MultipleThreadsParser.WorkMessage) {
|
// if (message instanceof edu.lu.uni.serval.fixminer.cluster.akka.EDiffMessage) {
|
||||||
TreeMessage msg = (TreeMessage) message;
|
TreeMessage msg = (TreeMessage) message;
|
||||||
List<String> files = msg.getName();
|
List<String> files = msg.getName();
|
||||||
JedisPool innerPool = msg.getInnerPool();
|
JedisPool innerPool = msg.getInnerPool();
|
||||||
+3
-2
@@ -1,6 +1,7 @@
|
|||||||
package edu.lu.uni.serval.fixminer.cluster;
|
package edu.lu.uni.serval.fixminer.jobs;
|
||||||
|
|
||||||
import edu.lu.uni.serval.FixPattern.utils.PoolBuilder;
|
import edu.lu.uni.serval.utils.CallShell;
|
||||||
|
import edu.lu.uni.serval.utils.PoolBuilder;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import redis.clients.jedis.Jedis;
|
import redis.clients.jedis.Jedis;
|
||||||
+3
-2
@@ -1,6 +1,7 @@
|
|||||||
package edu.lu.uni.serval.fixminer.cluster;
|
package edu.lu.uni.serval.fixminer.jobs;
|
||||||
|
|
||||||
import edu.lu.uni.serval.FixPattern.utils.PoolBuilder;
|
import edu.lu.uni.serval.utils.CallShell;
|
||||||
|
import edu.lu.uni.serval.utils.PoolBuilder;
|
||||||
import edu.lu.uni.serval.utils.FileHelper;
|
import edu.lu.uni.serval.utils.FileHelper;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
+6
-6
@@ -1,10 +1,10 @@
|
|||||||
package edu.lu.uni.serval.fixminer;
|
package edu.lu.uni.serval.fixminer.jobs;
|
||||||
|
|
||||||
import akka.actor.ActorRef;
|
import akka.actor.ActorRef;
|
||||||
import akka.actor.ActorSystem;
|
import akka.actor.ActorSystem;
|
||||||
import edu.lu.uni.serval.MultipleThreadsParser.MessageFile;
|
import edu.lu.uni.serval.fixminer.cluster.akka.EDiffMessage;
|
||||||
import edu.lu.uni.serval.MultipleThreadsParser.ParseFixPatternActor;
|
import edu.lu.uni.serval.fixminer.cluster.akka.MessageFile;
|
||||||
import edu.lu.uni.serval.MultipleThreadsParser.WorkMessage;
|
import edu.lu.uni.serval.fixminer.cluster.akka.EDiffActor;
|
||||||
import edu.lu.uni.serval.utils.FileHelper;
|
import edu.lu.uni.serval.utils.FileHelper;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -56,12 +56,12 @@ public class EnhancedASTDiff {
|
|||||||
|
|
||||||
ActorSystem system = null;
|
ActorSystem system = null;
|
||||||
ActorRef parsingActor = null;
|
ActorRef parsingActor = null;
|
||||||
final WorkMessage msg = new WorkMessage(0, msgFiles);
|
final EDiffMessage msg = new EDiffMessage(0, msgFiles);
|
||||||
try {
|
try {
|
||||||
log.info("Akka begins...");
|
log.info("Akka begins...");
|
||||||
system = ActorSystem.create("Mining-FixPattern-System");
|
system = ActorSystem.create("Mining-FixPattern-System");
|
||||||
|
|
||||||
parsingActor = system.actorOf(ParseFixPatternActor.props(Integer.valueOf(numOfWorkers), project), "mine-fix-pattern-actor");
|
parsingActor = system.actorOf(EDiffActor.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) {
|
||||||
system.shutdown();
|
system.shutdown();
|
||||||
+2
-1
@@ -1,5 +1,6 @@
|
|||||||
package edu.lu.uni.serval.fixminer.cluster;
|
package edu.lu.uni.serval.fixminer.jobs;
|
||||||
|
|
||||||
|
import edu.lu.uni.serval.utils.CallShell;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
+6
-5
@@ -1,4 +1,4 @@
|
|||||||
package edu.lu.uni.serval.fixminer.cluster;
|
package edu.lu.uni.serval.fixminer.jobs;
|
||||||
|
|
||||||
import com.github.gumtreediff.actions.ActionGenerator;
|
import com.github.gumtreediff.actions.ActionGenerator;
|
||||||
import com.github.gumtreediff.actions.model.Action;
|
import com.github.gumtreediff.actions.model.Action;
|
||||||
@@ -6,10 +6,11 @@ import com.github.gumtreediff.matchers.Matcher;
|
|||||||
import com.github.gumtreediff.matchers.Matchers;
|
import com.github.gumtreediff.matchers.Matchers;
|
||||||
import com.github.gumtreediff.tree.ITree;
|
import com.github.gumtreediff.tree.ITree;
|
||||||
import com.github.gumtreediff.tree.TreeContext;
|
import com.github.gumtreediff.tree.TreeContext;
|
||||||
import edu.lu.uni.serval.FixPattern.utils.EDiff;
|
import edu.lu.uni.serval.utils.CallShell;
|
||||||
import edu.lu.uni.serval.FixPattern.utils.EDiffHelper;
|
import edu.lu.uni.serval.utils.EDiff;
|
||||||
import edu.lu.uni.serval.FixPattern.utils.PoolBuilder;
|
import edu.lu.uni.serval.utils.EDiffHelper;
|
||||||
import edu.lu.uni.serval.gumtree.regroup.HierarchicalActionSet;
|
import edu.lu.uni.serval.utils.PoolBuilder;
|
||||||
|
import edu.lu.uni.serval.FixPatternParser.HierarchicalActionSet;
|
||||||
import edu.lu.uni.serval.utils.FileHelper;
|
import edu.lu.uni.serval.utils.FileHelper;
|
||||||
import org.javatuples.Pair;
|
import org.javatuples.Pair;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
+5
-4
@@ -1,10 +1,11 @@
|
|||||||
package edu.lu.uni.serval.fixminer.cluster;
|
package edu.lu.uni.serval.fixminer.jobs;
|
||||||
|
|
||||||
import com.github.gumtreediff.tree.ITree;
|
import com.github.gumtreediff.tree.ITree;
|
||||||
import com.github.gumtreediff.tree.TreeContext;
|
import com.github.gumtreediff.tree.TreeContext;
|
||||||
import edu.lu.uni.serval.FixPattern.utils.EDiffHelper;
|
import edu.lu.uni.serval.utils.CallShell;
|
||||||
import edu.lu.uni.serval.FixPattern.utils.PoolBuilder;
|
import edu.lu.uni.serval.utils.EDiffHelper;
|
||||||
import edu.lu.uni.serval.gumtree.regroup.HierarchicalActionSet;
|
import edu.lu.uni.serval.utils.PoolBuilder;
|
||||||
|
import edu.lu.uni.serval.FixPatternParser.HierarchicalActionSet;
|
||||||
import edu.lu.uni.serval.utils.FileHelper;
|
import edu.lu.uni.serval.utils.FileHelper;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.text.similarity.JaroWinklerDistance;
|
import org.apache.commons.text.similarity.JaroWinklerDistance;
|
||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
package edu.lu.uni.serval.fixminer;
|
package edu.lu.uni.serval.fixminer.jobs;
|
||||||
|
|
||||||
import edu.lu.uni.serval.FixPattern.utils.Checker;
|
import edu.lu.uni.serval.utils.Checker;
|
||||||
import edu.lu.uni.serval.gumtree.regroup.HierarchicalActionSet;
|
import edu.lu.uni.serval.FixPatternParser.HierarchicalActionSet;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import redis.clients.jedis.Jedis;
|
import redis.clients.jedis.Jedis;
|
||||||
+5
-4
@@ -1,8 +1,9 @@
|
|||||||
package edu.lu.uni.serval.fixminer.cluster;
|
package edu.lu.uni.serval.fixminer.jobs;
|
||||||
|
|
||||||
import edu.lu.uni.serval.FixPattern.utils.EDiffHelper;
|
import edu.lu.uni.serval.utils.CallShell;
|
||||||
import edu.lu.uni.serval.FixPattern.utils.PoolBuilder;
|
import edu.lu.uni.serval.utils.EDiffHelper;
|
||||||
import edu.lu.uni.serval.gumtree.regroup.HierarchicalActionSet;
|
import edu.lu.uni.serval.utils.PoolBuilder;
|
||||||
|
import edu.lu.uni.serval.FixPatternParser.HierarchicalActionSet;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import redis.clients.jedis.Jedis;
|
import redis.clients.jedis.Jedis;
|
||||||
+3
-2
@@ -1,6 +1,7 @@
|
|||||||
package edu.lu.uni.serval.fixminer.cluster;
|
package edu.lu.uni.serval.fixminer.jobs;
|
||||||
|
|
||||||
import edu.lu.uni.serval.FixPattern.utils.PoolBuilder;
|
import edu.lu.uni.serval.utils.CallShell;
|
||||||
|
import edu.lu.uni.serval.utils.PoolBuilder;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import redis.clients.jedis.Jedis;
|
import redis.clients.jedis.Jedis;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package edu.lu.uni.serval.FixPattern.utils;
|
package edu.lu.uni.serval.utils;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package edu.lu.uni.serval.fixminer.cluster;
|
package edu.lu.uni.serval.utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by anilkoyuncu on 17/04/2018.
|
* Created by anilkoyuncu on 17/04/2018.
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package edu.lu.uni.serval.FixPattern.utils;
|
package edu.lu.uni.serval.utils;
|
||||||
|
|
||||||
public class Checker {
|
public class Checker {
|
||||||
|
|
||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
package edu.lu.uni.serval.FixPattern.utils;
|
package edu.lu.uni.serval.utils;
|
||||||
|
|
||||||
import com.github.gumtreediff.actions.model.*;
|
import com.github.gumtreediff.actions.model.*;
|
||||||
import com.github.gumtreediff.tree.ITree;
|
import com.github.gumtreediff.tree.ITree;
|
||||||
import com.github.gumtreediff.tree.TreeContext;
|
import com.github.gumtreediff.tree.TreeContext;
|
||||||
import edu.lu.uni.serval.gumtree.regroup.HierarchicalActionSet;
|
import edu.lu.uni.serval.FixPatternParser.HierarchicalActionSet;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import redis.clients.jedis.Jedis;
|
import redis.clients.jedis.Jedis;
|
||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
package edu.lu.uni.serval.FixPattern.utils;
|
package edu.lu.uni.serval.utils;
|
||||||
|
|
||||||
import com.github.gumtreediff.tree.ITree;
|
import com.github.gumtreediff.tree.ITree;
|
||||||
import com.github.gumtreediff.tree.TreeContext;
|
import com.github.gumtreediff.tree.TreeContext;
|
||||||
import edu.lu.uni.serval.gumtree.regroup.HierarchicalActionSet;
|
import edu.lu.uni.serval.FixPatternParser.HierarchicalActionSet;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package edu.lu.uni.serval.FixPattern.utils;
|
package edu.lu.uni.serval.utils;
|
||||||
|
|
||||||
import redis.clients.jedis.JedisPoolConfig;
|
import redis.clients.jedis.JedisPoolConfig;
|
||||||
|
|
||||||
Reference in New Issue
Block a user