use of org.kie.workbench.common.stunner.bpmn.definition.property.simulation.SimulationAttributeSet in project kie-wb-common by kiegroup.
the class Simulations method simulationAttributeSet.
public static SimulationAttributeSet simulationAttributeSet(ElementParameters eleType) {
SimulationAttributeSet simulationSet = new SimulationAttributeSet();
TimeParameters timeParams = eleType.getTimeParameters();
if (timeParams == null) {
return simulationSet;
}
Parameter processingTime = timeParams.getProcessingTime();
ParameterValue paramValue = processingTime.getParameterValue().get(0);
return Match.of(ParameterValue.class, SimulationAttributeSet.class).when(NormalDistributionType.class, ndt -> {
simulationSet.getMean().setValue(ndt.getMean());
simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation());
simulationSet.getDistributionType().setValue("normal");
return simulationSet;
}).when(UniformDistributionType.class, udt -> {
simulationSet.getMin().setValue(udt.getMin());
simulationSet.getMax().setValue(udt.getMax());
simulationSet.getDistributionType().setValue("uniform");
return simulationSet;
}).when(PoissonDistributionType.class, pdt -> {
simulationSet.getMean().setValue(pdt.getMean());
simulationSet.getDistributionType().setValue("poisson");
return simulationSet;
}).apply(paramValue).asSuccess().value();
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.simulation.SimulationAttributeSet 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();
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