using System; using Ringtoets.Piping.Data.Properties; namespace Ringtoets.Piping.Data.Probabilistics { /// /// This class is a representation of a variable derived from a probabilistic distribution, /// based on a percentile. /// public class DesignVariable { private double percentile; private IDistribution distribution; /// /// Initializes a new instance of the class with /// equal to 0.5. /// /// is null. public DesignVariable(IDistribution distribution) { Distribution = distribution; percentile = 0.5; } /// /// Gets or sets the probabilistic distribution of the parameter being modeled. /// /// is null. public IDistribution Distribution { get { return distribution; } set { if (value == null) { throw new ArgumentNullException("value", Resources.DesignVariable_GetDesignValue_Distribution_must_be_set); } distribution = value; } } /// /// Gets or sets the percentile used to derive a deterministic value based on . /// public double Percentile { get { return percentile; } set { if (value < 0.0 || value > 1.0) { throw new ArgumentOutOfRangeException("value", Resources.DesignVariable_Percentile_must_be_in_range); } percentile = value; } } /// /// Gets the design value based on the and . /// /// A design value. public double GetDesignValue() { return Distribution.InverseCDF(Percentile); } } }