public override IDistributedParameter CreateNewEntity(IContainer container) { var parameter = base.CreateNewEntity(container) .WithParentContainer(container) .WithDimension(_dimensionFactory.TryGetDimension(_interactionTaskContext.UserSettings.ParameterDefaultDimension)); parameter.DisplayUnit = _interactionTaskContext.DisplayUnitFor(parameter); var percentile = _parameterFactory.CreateParameter(Constants.Distribution.PERCENTILE, AppConstants.DEFAULT_PERCENTILE, _dimensionFactory.Dimension(AppConstants.DimensionNames.FRACTION)); var mean = _parameterFactory.CreateParameter(Constants.Distribution.MEAN, AppConstants.DEFAULT_PARAMETER_START_VALUE, parameter.Dimension); var deviation = _parameterFactory.CreateParameter(Constants.Distribution.DEVIATION, AppConstants.DEFAULT_PARAMETER_START_VALUE, parameter.Dimension); parameter.Add(percentile); parameter.Add(mean); parameter.Add(deviation); parameter.Formula = _distributionFormulaFactory.CreateNormalDistributionFormulaFor(parameter, mean, deviation); return(parameter); }
public void UpdateDistributionFormula() { IDistributionFormula newFormula; switch (_distributedParameterDTO.FormulaType) { case DistributionFormulaType.DiscreteDistribution: checkChildrenForDiscreteDistributionProperties(); newFormula = _distributionFormulaFactory.CreateDiscreteDistributionFormulaFor(_distributedParameter, getChildParameter(Constants.Distribution.MEAN)); break; case DistributionFormulaType.NormalDistribution: checkChildrenForNormalDistributionProperties(); newFormula = _distributionFormulaFactory.CreateNormalDistributionFormulaFor(_distributedParameter, getChildParameter(Constants.Distribution.MEAN), getChildParameter(Constants.Distribution.DEVIATION)); break; case DistributionFormulaType.UniformDistribution: checkChildrenForUniformDistributionProperties(); newFormula = _distributionFormulaFactory.CreateUniformDistributionFormulaFor(_distributedParameter, getChildParameter(Constants.Distribution.MINIMUM), getChildParameter(Constants.Distribution.MAXIMUM)); break; case DistributionFormulaType.LogNormalDistribution: checkChildrenForLogNormalDistributionProperties(); newFormula = _distributionFormulaFactory.CreateLogNormalDistributionFormulaFor(_distributedParameter, getChildParameter(Constants.Distribution.MEAN), getChildParameter(Constants.Distribution.GEOMETRIC_DEVIATION)); break; default: throw new ArgumentOutOfRangeException("distributionFormulaType"); } updateDistributedFormula(newFormula); rebind(); }