Search in sources :

Example 11 with ParameterValue

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();
}
Also used : NormalDistributionType(bpsim.NormalDistributionType) ParameterValue(bpsim.ParameterValue) Parameter(bpsim.Parameter) PoissonDistributionType(bpsim.PoissonDistributionType) Match(org.kie.workbench.common.stunner.bpmn.backend.converters.Match) ElementParameters(bpsim.ElementParameters) TimeParameters(bpsim.TimeParameters) Factories.bpsim(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpsim) UniformDistributionType(bpsim.UniformDistributionType) SimulationAttributeSet(org.kie.workbench.common.stunner.bpmn.definition.property.simulation.SimulationAttributeSet) PoissonDistributionType(bpsim.PoissonDistributionType) SimulationAttributeSet(org.kie.workbench.common.stunner.bpmn.definition.property.simulation.SimulationAttributeSet) ParameterValue(bpsim.ParameterValue) NormalDistributionType(bpsim.NormalDistributionType) Parameter(bpsim.Parameter) TimeParameters(bpsim.TimeParameters)

Aggregations

ParameterValue (bpsim.ParameterValue)11 Parameter (bpsim.Parameter)6 TimeParameters (bpsim.TimeParameters)6 SimulationAttributeSet (org.kie.workbench.common.stunner.bpmn.definition.property.simulation.SimulationAttributeSet)6 ElementParameters (bpsim.ElementParameters)5 FloatingParameterType (bpsim.FloatingParameterType)5 NormalDistributionType (bpsim.NormalDistributionType)5 PoissonDistributionType (bpsim.PoissonDistributionType)5 UniformDistributionType (bpsim.UniformDistributionType)5 Match (org.kie.workbench.common.stunner.bpmn.backend.converters.Match)4 CostParameters (bpsim.CostParameters)3 ResourceParameters (bpsim.ResourceParameters)3 EList (org.eclipse.emf.common.util.EList)3 Test (org.junit.Test)3 SimulationSet (org.kie.workbench.common.stunner.bpmn.definition.property.simulation.SimulationSet)3 VoidMatch (org.kie.workbench.common.stunner.bpmn.backend.converters.VoidMatch)2 Factories.bpsim (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpsim)2