Search in sources :

Example 6 with Developer

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;
}
Also used : ArrayList(java.util.ArrayList) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) Developer(aserg.gtf.model.authorship.Developer) ArrayList(java.util.ArrayList) List(java.util.List) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList)

Example 7 with Developer

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;
}
Also used : AuthorshipInfo(aserg.gtf.model.authorship.AuthorshipInfo) Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) Developer(aserg.gtf.model.authorship.Developer) File(aserg.gtf.model.authorship.File) HashSet(java.util.HashSet)

Example 8 with Developer

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);
}
Also used : Developer(aserg.gtf.model.authorship.Developer)

Example 9 with Developer

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);
        }
    }
}
Also used : RepositoryDAO(aserg.gtf.dao.authorship.RepositoryDAO) DeveloperDAO(aserg.gtf.dao.authorship.DeveloperDAO) Repository(aserg.gtf.model.authorship.Repository) Developer(aserg.gtf.model.authorship.Developer) ArrayList(java.util.ArrayList) List(java.util.List) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList)

Aggregations

Developer (aserg.gtf.model.authorship.Developer)9 ArrayList (java.util.ArrayList)3 HashSet (java.util.HashSet)3 List (java.util.List)3 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)3 HashMap (java.util.HashMap)2 Set (java.util.Set)2 DeveloperDAO (aserg.gtf.dao.authorship.DeveloperDAO)1 RepositoryDAO (aserg.gtf.dao.authorship.RepositoryDAO)1 AuthorshipInfo (aserg.gtf.model.authorship.AuthorshipInfo)1 File (aserg.gtf.model.authorship.File)1 Repository (aserg.gtf.model.authorship.Repository)1 SimpleDateFormat (java.text.SimpleDateFormat)1