public void Calculate(Dictionary<String, FilePaths> authors, FilePaths totalCommits) { InitializeAuthorIndex(authors); foreach (string path in totalCommits.Keys) { int pathCommitCount = Convert.ToInt32(totalCommits[path]); Dictionary<string, int> listOfAuthors = GetListOfAuthors(path, authors); CalculateNumberOfAuthors(path, listOfAuthors, pathCommitCount, COMMIT_THRESHOLD); } GetSourceCodeDirectories(codeDistribution); foreach (string directory in OwnershipDistribution.Keys) { foreach (string path in codeDistribution.Keys) { if (DirectoryComparison(path, directory)) OwnershipDistribution[directory].Add(codeDistribution[path]); } } RemoveEmptyDirectories(); }
private void GetSourceCodeDirectories(FilePaths codeDistribution) { foreach (string path in codeDistribution.Keys) { int lastDir = 0; string trimmedPath = path; while (lastDir != -1 && trimmedPath.Length != 0) { lastDir = trimmedPath.LastIndexOf("/"); trimmedPath = path.Remove(lastDir); if (!OwnershipDistribution.ContainsKey(trimmedPath)) OwnershipDistribution.Add(trimmedPath, new List<int>()); } } }