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; /// /// Initializes a new instance of the class with /// equal to 0.5. /// public DesignVariable() { percentile = 0.5; } /// /// Gets or sets the probabilistic distribution of the parameter being modeled. /// public IDistribution Distribution { get; set; } /// /// 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. /// is null. public double GetDesignValue() { if (Distribution == null) { throw new InvalidOperationException(Resources.DesignVariable_GetDesignValue_Distribution_must_be_set); } return Distribution.InverseCDF(Percentile); } } }