Skip to content

Commit 7051b19

Browse files
committed
Implement/adapt DoplerStatistics
1 parent f346e63 commit 7051b19

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/main/java/edu/kit/travart/dopler/transformation/util/DoplerStatistics.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import at.jku.cps.travart.core.common.IStatistics;
66
import edu.kit.dopler.model.Dopler;
7+
import edu.kit.dopler.model.EnumerationDecision;
78

89
public class DoplerStatistics implements IStatistics<Dopler> {
910

@@ -22,8 +23,14 @@ public static DoplerStatistics getInstance() {
2223
public int getVariabilityElementsCount(Dopler model) {
2324
// TODO Is is the right way to calculate size for DOPLER decision models?
2425
// Previously: Only #decisions + #assets
25-
return model.getDecisions().stream().mapToInt(e -> e.getRules().size()).sum()
26-
+ model.getAssets().size();
26+
// Try to calculate the number of branches
27+
return model.getDecisions().stream().mapToInt(e -> {
28+
if (e instanceof EnumerationDecision) {
29+
return ((EnumerationDecision) e).getEnumeration().getEnumerationLiterals().size();
30+
} else {
31+
return 1;
32+
}
33+
}).sum() + model.getAssets().size();
2734
}
2835

2936
@Override

0 commit comments

Comments
 (0)