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);
}
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);
}
}
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);
}
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;
}
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;
}
Aggregations