# Counting the number of active Java projects with SVN
p:Project = input;
committers: output sum[int] of int;
java_projects: output sum of int;
java_repos: output sum of int;
empty_list: output collection [int] of string;
spring_projects: output sum of int;
spring_project_committers: output sum[int] of int;
spring_projects_commiters_gt4_commits: output sum[int] of int;
spring_projects_commiters_gt4_commits_gt_20: output sum[int] of int;
spring_projects_commiters_gt4_commits_gt_20_url: output collection of string;
empty := false;
names: map[string] of bool;
index := 0;
count :=0;
spring := false;
declarations : map[string] of bool;
visit(p, visitor {
before n: Project -> {
ifall (i: int; !match(`^java$`, lowercase(n.programming_languages[i])))
stop;
}
before n: Person -> {
names[n.real_name] = true;
}
after cr: CodeRepository -> {
java_repos << 1;
if (len(names) == 0) {
empty = true;
}
if (spring)
{
spring_projects << 1;
spring_project_committers[len(names)] << 1;
if (len(names) > 4) {
spring_projects_commiters_gt4_commits[len(cr.revisions)] << 1;
if (len(cr.revisions) > 20){
spring_projects_commiters_gt4_commits_gt_20[len(declarations)] << 1;
spring_projects_commiters_gt4_commits_gt_20_url << cr.url;
}
}
}
clear(names);
}
after n: Project -> {
java_projects << 1;
if (empty)
{
index = index + 1;
}
}
# look for imports
before node: ASTRoot ->
exists(j: int; match("^org\\.springframework\\.”, node.imports[j])) {
spring = true;
}
# look for FQN
before node: Type ->
if (match("^org\\.springframework\\.”,
node.name)) {
spring = true;
stop;
}
});