use of aserg.gtf.model.authorship.Developer in project Truck-Factor by aserg-ufmg.
the class AliasesIdentifier method treatAliases.
private static List<Developer> treatAliases(String repName, Map<Developer, List<Developer>> aliases) {
List<Developer> devAliases = new ArrayList<Developer>();
for (Entry<Developer, List<Developer>> entry : aliases.entrySet()) {
Developer dev1 = entry.getKey();
for (Developer dev2 : entry.getValue()) {
if (Alias.isAlias(repName, dev1.getName(), dev2.getName())) {
System.out.println(repName + ";" + dev1.getName() + ";" + dev2.getName());
dev2.setNewUserName(dev1.getName());
mergeAliasesAuthorship(dev1, dev2);
devAliases.add(dev1);
devAliases.add(dev2);
} else {
System.err.println("-" + repName + ";" + dev1.getName() + ";" + dev2.getName());
}
}
//System.out.println();
}
return devAliases;
}
use of aserg.gtf.model.authorship.Developer in project Truck-Factor by aserg-ufmg.
the class GreedyTruckFactor method getFilesAuthorMap.
private Map<Developer, Set<File>> getFilesAuthorMap(Repository repository) {
Map<Developer, Set<File>> map = new HashMap<Developer, Set<File>>();
List<Developer> developers = repository.getDevelopers();
for (Developer developer : developers) {
Set<File> devFiles = new HashSet<File>();
List<AuthorshipInfo> authorships = developer.getAuthorshipInfos();
for (AuthorshipInfo authorshipInfo : authorships) {
if (authorshipInfo.isDOAAuthor())
devFiles.add(authorshipInfo.getFile());
}
if (devFiles.size() > 0)
map.put(developer, devFiles);
}
return map;
}
use of aserg.gtf.model.authorship.Developer in project Truck-Factor by aserg-ufmg.
the class AliasesIdentifier method joinAlias.
private static void joinAlias(String repositoryName, DeveloperDAO devDAO) {
List<String> developersUsernames = devDAO.getDuplicatedUsernames(repositoryName);
System.out.println(repositoryName + ";emailsdiff;" + developersUsernames.size());
int count = 0;
for (String devUsername : developersUsernames) {
if (!devUsername.isEmpty()) {
List<Developer> devs = devDAO.getDevelopers(repositoryName, devUsername);
Developer mainDev = devs.get(0);
for (Developer developer : devs) {
if (developer != mainDev) {
mergeAliasesAuthorship(mainDev, developer);
count++;
}
}
for (Developer developer : devs) {
devDAO.update(developer);
}
}
}
System.out.println(repositoryName + ";total;" + count);
}
use of aserg.gtf.model.authorship.Developer in project Truck-Factor by aserg-ufmg.
the class AliasesIdentifier method main.
public static void main(String[] args) {
RepositoryDAO repDAO = new RepositoryDAO();
DeveloperDAO devDAO = new DeveloperDAO();
//StringUtils.getLevenshteinDistance("", "");
for (Repository rep : repDAO.findAll()) {
if (rep.getStatus() != RepositoryStatus.REMOVED) {
joinAlias(rep.getFullName(), devDAO);
List<Developer> developers = devDAO.getAllDevelopers(rep.getFullName());
Map<Developer, List<Developer>> aliases = findAliases(developers, 1, 3);
List<Developer> devAliases = treatAliases(rep.getFullName(), aliases);
updateDeveloperAliases(devDAO, devAliases);
}
}
}
Aggregations