for (int i = 0; i < getMatrix().getNodes().size(); i++) {
EntityMatrixNode node = getMatrix().getNodes().get(i);
String[] columns = node.getLine().split(JsfUtil.TOKEN_SEPARATOR);
AuxFileFile pairFile = new AuxFileFile(columns[1], columns[2]);
AuxUserUser pairUser = new AuxUserUser(columns[0], columns[3]);
// to count unique developers
distinctDevelopers.add(pairUser.getUser());
distinctDevelopers.add(pairUser.getUser2());
/**
* Extract all distinct developer that commit a pair of file
*/
if (commitersPairFile.containsKey(pairFile)) {
Set<String> commiters = commitersPairFile.get(pairFile);
commiters.add(pairUser.getUser());
commiters.add(pairUser.getUser2());
} else {
Set<String> commiters = new HashSet<>();
commiters.add(pairUser.getUser());
commiters.add(pairUser.getUser2());
commitersPairFile.put(pairFile, commiters);
}
String edgeName = pairUser.toString();
// to count unique files
distinctFiles.add(pairFile.getFileName());
distinctFiles.add(pairFile.getFileName2());
pairFiles.add(pairFile);
edgeFiles.put(edgeName, pairFile);
String weightedEdge = (String) params.get("weightedEdge");
if ("false".equalsIgnoreCase(weightedEdge)) {
// binary edge weight
edgeWeigth.put(edgeName, 1);
} else {
/* Sum commit for each pair file that the pair dev has commited. */
if (edgeWeigth.containsKey(pairUser.toStringUserAndUser2())) {
// edgeName = user + user2
edgeWeigth.put(pairUser.toStringUserAndUser2(), edgeWeigth.get(pairUser.toStringUserAndUser2()) + Integer.valueOf(columns[4]));
} else if (edgeWeigth.containsKey(pairUser.toStringUser2AndUser())) {
// edgeName = user2 + user
edgeWeigth.put(pairUser.toStringUser2AndUser(), edgeWeigth.get(pairUser.toStringUser2AndUser()) + Integer.valueOf(columns[4]));
} else {
edgeWeigth.put(edgeName, Integer.valueOf(columns[4]));
}
}
if (!pairFileCommitCount.containsKey(pairFile)) {
pairFileCommitCount.put(pairFile,
pairFileDAO.calculeSumUpdatesOfTwoFile( repository,
pairFile.getFileName(), pairFile.getFileName2(),
beginDate, endDate));
}
/**
* The co-change network is constructed as follow: If developer A
* and developer B commits a pair file PF, then they are connected
* in network.
*/
if (!graph.containsVertex(pairUser.getUser())
|| !graph.containsVertex(pairUser.getUser2())
|| !graph.isNeighbor(pairUser.getUser(), pairUser.getUser2())) {
graph.addEdge(edgeName, pairUser.getUser(), pairUser.getUser2(), EdgeType.UNDIRECTED);
}
}
out.printLog("Weigth of edges:");
for (Map.Entry<String, Integer> entry : edgeWeigth.entrySet()) {
out.printLog(entry.getKey() + " " + entry.getValue());