public SimulationAttributeSet(final Double min, final Double max, final Double mean, final String timeUnit, final Double standardDeviation, final String distributionType) { this.min = new Min(min); this.max = new Max(max); this.mean = new Mean(mean); this.timeUnit = new TimeUnit(timeUnit); this.standardDeviation = new StandardDeviation(standardDeviation); this.distributionType = new DistributionType(distributionType); }
@Override public boolean equals(Object o) { if (o instanceof SimulationAttributeSet) { SimulationAttributeSet other = (SimulationAttributeSet) o; return min.equals(other.min) && max.equals(other.max) && mean.equals(other.mean) && timeUnit.equals(other.timeUnit) && standardDeviation.equals(other.standardDeviation) && distributionType.equals(other.distributionType); } return false; } }
@Override public int hashCode() { return HashUtil.combineHashCodes(min.hashCode(), max.hashCode(), mean.hashCode(), timeUnit.hashCode(), standardDeviation.hashCode(), distributionType.hashCode()); }
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(); }
case "uniform": UniformDistributionType udt = bpsim.createUniformDistributionType(); udt.setMin(simulationSet.getMin().getValue()); udt.setMax(simulationSet.getMax().getValue()); processingTime.getParameterValue().add(udt);
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(); }
case "uniform": UniformDistributionType udt = bpsim.createUniformDistributionType(); udt.setMin(simulationSet.getMin().getValue()); udt.setMax(simulationSet.getMax().getValue()); processingTime.getParameterValue().add(udt);
}) .when(UniformDistributionType.class, udt -> { simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform");
public SimulationAttributeSet() { this(new Min(), new Max(), new Mean(), new TimeUnit(), new StandardDeviation(), new DistributionType()); }
@Override public int hashCode() { return HashUtil.combineHashCodes(min.hashCode(), max.hashCode(), mean.hashCode(), timeUnit.hashCode(), standardDeviation.hashCode(), distributionType.hashCode(), quantity.hashCode(), workingHours.hashCode(), unitCost.hashCode(), currency.hashCode()); }
@Override public boolean equals(Object o) { if (o instanceof SimulationSet) { SimulationSet other = (SimulationSet) o; return min.equals(other.min) && max.equals(other.max) && mean.equals(other.mean) && timeUnit.equals(other.timeUnit) && standardDeviation.equals(other.standardDeviation) && distributionType.equals(other.distributionType) && quantity.equals(other.quantity) && workingHours.equals(other.workingHours) && unitCost.equals(other.unitCost) && currency.equals(other.currency); } return false; } }
.when(UniformDistributionType.class, udt -> { SimulationSet sset = new SimulationSet(); sset.getMin().setValue(udt.getMin()); sset.getMax().setValue(udt.getMax()); sset.getDistributionType().setValue("uniform");
public SimulationSet() { this(new Min(), new Max(), new Mean(), new TimeUnit(), new StandardDeviation(), new DistributionType(), new Quantity(), new WorkingHours(), new UnitCost(), new Currency()); }