// Copyright (C) Stichting Deltares 2016. All rights reserved. // // This file is part of Ringtoets. // // Ringtoets is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . // // All names, logos, and references to "Deltares" are registered trademarks of // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. using System; using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Storage; using Ringtoets.Common.Data.Calculation; using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; namespace Ringtoets.Common.Data.Probability { /// /// This class contains the results of a probabilistic assessment calculation. /// public class ProbabilityAssessmentOutput : Observable, ICalculationOutput, IStorable { private double requiredProbability; private double probability; /// /// Creates a new instance of . /// /// The required (maximum allowed) probability of failure. /// The required (maximum allowed) reliability of the failure mechanism. /// The probability of failure. /// The reliability of the failure mechanism. /// The factor of safety of the failure mechanism. /// When setting a probability that falls /// outside the [0.0, 1.0] range and isn't . public ProbabilityAssessmentOutput(double requiredProbability, double requiredReliability, double probability, double reliability, double factorOfSafety) { RequiredProbability = requiredProbability; RequiredReliability = new RoundedDouble(3, requiredReliability); Probability = probability; Reliability = new RoundedDouble(3, reliability); FactorOfSafety = new RoundedDouble(3, factorOfSafety); } /// /// Gets the required (maximum allowed) probability of failure. /// /// When setting a value that falls /// outside the [0.0, 1.0] range and isn't . public double RequiredProbability { get { return requiredProbability; } private set { if (double.IsNaN(value) || (0.0 <= value && value <= 1.0)) { requiredProbability = value; } else { throw new ArgumentOutOfRangeException("value", RingtoetsCommonDataResources.Probability_Must_be_in_range_zero_to_one); } } } /// /// Get the required (maximum allowed) reliability of the failure mechanism. /// public RoundedDouble RequiredReliability { get; private set; } /// /// Gets the probability of failure. /// /// When setting a value that falls /// outside the [0.0, 1.0] range or isn't . public double Probability { get { return probability; } private set { if (double.IsNaN(value) || (0.0 <= value && value <= 1.0)) { probability = value; } else { throw new ArgumentOutOfRangeException("value", RingtoetsCommonDataResources.Probability_Must_be_in_range_zero_to_one); } } } /// /// Gets the reliability of the failure mechanism. /// public RoundedDouble Reliability { get; private set; } /// /// Gets the factor of safety of the failure mechanism. /// public RoundedDouble FactorOfSafety { get; private set; } public long StorageId { get; set; } } }