Softwaretechnik-II/boa/mining/aufgabe_01_b.boa

34 lines
880 B
Plaintext
Raw Normal View History

2025-01-11 00:48:27 +01:00
# Java-Job: 111694
# Python-Job: 111439
2025-01-03 21:21:22 +01:00
# Includes all revisions
p: Project = input;
# Prepare output variables
relative_list: output mean[string][int] of float;
# Temporary variables
cur_date: time;
statement_counter := visitor {
before node: Statement -> {
2025-01-11 00:48:27 +01:00
if (def(node.kind) and (node.kind == StatementKind.TRY or node.kind == StatementKind.WITH))
2025-01-03 21:21:22 +01:00
relative_list[p.name][yearof(cur_date)] << 1;
else
relative_list[p.name][yearof(cur_date)] << 0;
}
};
visit(p, visitor {
before node: CodeRepository -> {
for (minus_year: int=22; minus_year >= 0; minus_year--) {
2025-01-11 00:48:27 +01:00
cur_date = addyear(T"Dec 31, 2022, 10:00:00 AM", -minus_year);
2025-01-03 21:21:22 +01:00
snapshot := getsnapshot(node, cur_date);
2025-01-11 00:48:27 +01:00
foreach (i: int; def(snapshot[i]))
visit(snapshot[i], statement_counter);
2025-01-03 21:21:22 +01:00
}
}
});