use of bpsim.ParameterValue in project kie-wb-common by kiegroup.
the class SimulationAttributeSets method of.
public static SimulationAttributeSet of(ElementParameters eleType) {
TimeParameters timeParams = eleType.getTimeParameters();
if (timeParams == null) {
return new SimulationAttributeSet();
}
Parameter processingTime = timeParams.getProcessingTime();
if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) {
return new SimulationAttributeSet();
}
ParameterValue paramValue = processingTime.getParameterValue().get(0);
return Match.of(ParameterValue.class, SimulationAttributeSet.class).when(NormalDistributionType.class, ndt -> {
SimulationAttributeSet simulationSet = new SimulationAttributeSet();
simulationSet.getMean().setValue(ndt.getMean());
simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation());
simulationSet.getDistributionType().setValue("normal");
return simulationSet;
}).when(UniformDistributionType.class, udt -> {
SimulationAttributeSet simulationSet = new SimulationAttributeSet();
simulationSet.getMin().setValue(udt.getMin());
simulationSet.getMax().setValue(udt.getMax());
simulationSet.getDistributionType().setValue("uniform");
return simulationSet;
}).when(PoissonDistributionType.class, pdt -> {
SimulationAttributeSet simulationSet = new SimulationAttributeSet();
simulationSet.getMean().setValue(pdt.getMean());
simulationSet.getDistributionType().setValue("poisson");
return simulationSet;
}).apply(paramValue).asSuccess().value();
}
Aggregations