Search in sources :

Example 1 with Developer

use of aserg.gtf.model.authorship.Developer in project Truck-Factor by aserg-ufmg.

the class GitTruckFactor method printCoverage.

private static void printCoverage(Repository repository, List<String> devsName, Calendar cal) {
    int nFiles = getTotalFiles(repository.getDevelopers());
    Set<String> devsFiles = new HashSet<String>();
    for (String devName : devsName) {
        for (Developer developer : repository.getDevelopers()) {
            if (developer.getName().equalsIgnoreCase(devName)) {
                devsFiles.addAll(getAuthorFiles(developer));
            }
        }
    }
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
    System.out.println("Coverage;" + format.format(cal.getTime()) + ";" + devsFiles.size() + ";" + nFiles + ";" + (float) devsFiles.size() / nFiles * 100);
}
Also used : Developer(aserg.gtf.model.authorship.Developer) SimpleDateFormat(java.text.SimpleDateFormat) HashSet(java.util.HashSet)

Example 2 with Developer

use of aserg.gtf.model.authorship.Developer in project Truck-Factor by aserg-ufmg.

the class DeveloperDAO method update.

public void update(Developer o) {
    Developer persistedDeveloper = this.em.find(Developer.class, o.getId());
    if (persistedDeveloper != null) {
        persistedDeveloper.setAuthorshipInfos(o.getAuthorshipInfos());
        persistedDeveloper.setEmail(o.getEmail());
        persistedDeveloper.setName(o.getName());
        persistedDeveloper.setNewUserName(o.getNewUserName());
        if (o.isRemoved())
            persistedDeveloper.setAsRemoved();
        persistedDeveloper.setStatus(o.getStatus());
        persistedDeveloper.setOrigemDevelopers(o.getOrigemDevelopers());
        super.merge(persistedDeveloper);
    }
}
Also used : Developer(aserg.gtf.model.authorship.Developer)

Example 3 with Developer

use of aserg.gtf.model.authorship.Developer in project Truck-Factor by aserg-ufmg.

the class GreedyTruckFactor method removeTopAuthor.

private void removeTopAuthor(int repFilesSize, Map<Developer, Set<File>> authorsMap) {
    int biggerNumber = 0;
    Developer biggerDev = null;
    for (Entry<Developer, Set<File>> entry : authorsMap.entrySet()) {
        if (entry.getValue().size() > biggerNumber) {
            biggerNumber = entry.getValue().size();
            biggerDev = entry.getKey();
        }
    }
    tfInfo.addDeveloper(biggerDev);
    authorsMap.remove(biggerDev);
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) Developer(aserg.gtf.model.authorship.Developer)

Example 4 with Developer

use of aserg.gtf.model.authorship.Developer in project Truck-Factor by aserg-ufmg.

the class TFInfo method toString.

@Override
public String toString() {
    String retStr = String.format("TF = %d (coverage = %.2f%%\n", tf, coverage * 100);
    retStr += "TF authors (Developer;Files;Percentage):\n";
    for (Developer developer : tfDevelopers) {
        int devFiles = developer.getAuthorshipFiles().size();
        retStr += String.format("%s;%d;%.2f\n", developer.getName(), devFiles, (float) devFiles / totalFiles * 100);
    }
    return retStr;
}
Also used : Developer(aserg.gtf.model.authorship.Developer)

Example 5 with Developer

use of aserg.gtf.model.authorship.Developer in project Truck-Factor by aserg-ufmg.

the class AliasesIdentifier method findAliases.

private static Map<Developer, List<Developer>> findAliases(List<Developer> allDevelopers, int distance, int minSize) {
    int newDistance = distance;
    List<Developer> copyList = new CopyOnWriteArrayList<Developer>(allDevelopers);
    Map<Developer, List<Developer>> aliases = new HashMap<Developer, List<Developer>>();
    for (Developer developer1 : copyList) {
        copyList.remove(developer1);
        for (Developer developer2 : copyList) {
            if (developer1.getId() != developer2.getId() && developer1.getName().length() >= minSize) {
                int localDistance = StringUtils.getLevenshteinDistance(convertToUTFLower(developer1.getName()), convertToUTFLower(developer2.getName()));
                if (distance == -1) {
                    newDistance = developer1.getName().split(" ").length;
                }
                if (!developer1.getName().equals(developer2.getName()) && localDistance <= newDistance) {
                    if (!aliases.containsKey(developer1))
                        aliases.put(developer1, new ArrayList<Developer>());
                    aliases.get(developer1).add(developer2);
                    copyList.remove(developer2);
                }
            }
        }
    }
    return aliases;
}
Also used : HashMap(java.util.HashMap) 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) 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