@Test public void testTimeParamsWithEmptyParameter() { TimeParameters timeParameters = factory.createTimeParameters(); Parameter parameter = factory.createParameter(); timeParameters.setProcessingTime(parameter); simulationParameters.setTimeParameters(timeParameters); assertEquals(new SimulationAttributeSet(), SimulationAttributeSets.of(simulationParameters)); }
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.<ParameterValue, SimulationAttributeSet>of() .<NormalDistributionType>when(e -> e instanceof NormalDistributionType, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .<UniformDistributionType>when(e -> e instanceof UniformDistributionType, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .<PoissonDistributionType>when(e -> e instanceof PoissonDistributionType, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); }
SimulationAttributeSets { 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.<ParameterValue, SimulationAttributeSet>of() .<NormalDistributionType>when(e -> e instanceof NormalDistributionType, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .<UniformDistributionType>when(e -> e instanceof UniformDistributionType, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .<PoissonDistributionType>when(e -> e instanceof PoissonDistributionType, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } }
SimulationAttributeSets { 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.<ParameterValue, SimulationAttributeSet>of() .<NormalDistributionType>when(e -> e instanceof NormalDistributionType, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .<UniformDistributionType>when(e -> e instanceof UniformDistributionType, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .<PoissonDistributionType>when(e -> e instanceof PoissonDistributionType, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); }  }
SimulationAttributeSets { 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.<ParameterValue, SimulationAttributeSet>of() .<NormalDistributionType>when(e -> e instanceof NormalDistributionType, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .<UniformDistributionType>when(e -> e instanceof UniformDistributionType, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .<PoissonDistributionType>when(e -> e instanceof PoissonDistributionType, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); }  static SimulationAttributeSet of(ElementParameters eleType); static ElementParameters toElementParameters(SimulationAttributeSet simulationSet); }
SimulationAttributeSets { 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.<ParameterValue, SimulationAttributeSet>of() .<NormalDistributionType>when(e -> e instanceof NormalDistributionType, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .<UniformDistributionType>when(e -> e instanceof UniformDistributionType, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .<PoissonDistributionType>when(e -> e instanceof PoissonDistributionType, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); }  static SimulationAttributeSet of(ElementParameters eleType); static ElementParameters toElementParameters(SimulationAttributeSet simulationSet);  }