use of org.drools.scenariosimulation.backend.runner.model.ScenarioResultMetadata in project drools by kiegroup.
the class SimulationRunMetadataBuilder method build.
public SimulationRunMetadata build() {
int available = 0;
Map<String, Integer> outputCounter = new HashMap<>();
Map<ScenarioWithIndex, Map<String, Integer>> scenarioCounter = new HashMap<>();
AuditLog auditLog = new AuditLog();
for (ScenarioResultMetadata scenarioResultMetadatum : scenarioResultMetadata) {
// this value is the same for all the scenarios
available = scenarioResultMetadatum.getAvailable().size();
scenarioResultMetadatum.getExecutedWithCounter().forEach((name, counter) -> outputCounter.compute(name, (key, number) -> number == null ? counter : number + counter));
}
for (ScenarioResultMetadata scenarioResultMetadatum : scenarioResultMetadata) {
scenarioCounter.put(scenarioResultMetadatum.getScenarioWithIndex(), scenarioResultMetadatum.getExecutedWithCounter());
auditLog.addAuditLogLines(scenarioResultMetadatum.getAuditLogLines());
}
return new SimulationRunMetadata(available, outputCounter.keySet().size(), outputCounter, scenarioCounter, auditLog);
}
Aggregations