Skip to content

Commit f346e63

Browse files
committed
Implement/adapt DoplerStatistics
1 parent c122f2e commit f346e63

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package edu.kit.travart.dopler.transformation.util;
2+
3+
import org.apache.logging.log4j.Logger;
4+
5+
import at.jku.cps.travart.core.common.IStatistics;
6+
import edu.kit.dopler.model.Dopler;
7+
8+
public class DoplerStatistics implements IStatistics<Dopler> {
9+
10+
private static DoplerStatistics instance;
11+
12+
private DoplerStatistics() {}
13+
14+
public static DoplerStatistics getInstance() {
15+
if (instance == null) {
16+
instance = new DoplerStatistics();
17+
}
18+
return instance;
19+
}
20+
21+
@Override
22+
public int getVariabilityElementsCount(Dopler model) {
23+
// TODO Is is the right way to calculate size for DOPLER decision models?
24+
// Previously: Only #decisions + #assets
25+
return model.getDecisions().stream().mapToInt(e -> e.getRules().size()).sum()
26+
+ model.getAssets().size();
27+
}
28+
29+
@Override
30+
public int getConstraintsCount(Dopler model) {
31+
return model.getDecisions().size();
32+
}
33+
34+
@Override
35+
public void logModelStatistics(Logger logger, Dopler model) {
36+
logger.info("TODO: Implement statistics overview message for DOPLER");
37+
}
38+
39+
}

0 commit comments

Comments
 (0)