Index: Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsCalculation.cs =================================================================== diff -u -r4cb44d36bec6a6f1b4c1c2ff2db086b9996a2b42 -r5294cbf38ddf4c3fdd7c37b78f1ab4fa89ad9b86 --- Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsCalculation.cs (.../GrassCoverErosionInwardsCalculation.cs) (revision 4cb44d36bec6a6f1b4c1c2ff2db086b9996a2b42) +++ Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsCalculation.cs (.../GrassCoverErosionInwardsCalculation.cs) (revision 5294cbf38ddf4c3fdd7c37b78f1ab4fa89ad9b86) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using Core.Common.Base; using Riskeer.Common.Data; using Riskeer.Common.Data.Calculation; @@ -35,6 +36,8 @@ /// Creates a new instance of . /// /// The norm to use in the calculation input. + /// Thrown when + /// is not in the interval {0.0, 0.1] or is . public GrassCoverErosionInwardsCalculation(double norm) { Name = RiskeerCommonDataResources.Calculation_DefaultName; Index: Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsCalculationScenario.cs =================================================================== diff -u -r4cb44d36bec6a6f1b4c1c2ff2db086b9996a2b42 -r5294cbf38ddf4c3fdd7c37b78f1ab4fa89ad9b86 --- Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsCalculationScenario.cs (.../GrassCoverErosionInwardsCalculationScenario.cs) (revision 4cb44d36bec6a6f1b4c1c2ff2db086b9996a2b42) +++ Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsCalculationScenario.cs (.../GrassCoverErosionInwardsCalculationScenario.cs) (revision 5294cbf38ddf4c3fdd7c37b78f1ab4fa89ad9b86) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using Core.Common.Base.Data; using Riskeer.Common.Data.Calculation; using Riskeer.Common.Data.Helpers; @@ -36,6 +37,8 @@ /// Creates a new instance of . /// /// The norm to use in the calculation input. + /// Thrown when + /// is not in the interval {0.0, 0.1] or is . public GrassCoverErosionInwardsCalculationScenario(double norm) : base(norm) { Index: Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsInput.cs =================================================================== diff -u -r4cb44d36bec6a6f1b4c1c2ff2db086b9996a2b42 -r5294cbf38ddf4c3fdd7c37b78f1ab4fa89ad9b86 --- Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsInput.cs (.../GrassCoverErosionInwardsInput.cs) (revision 4cb44d36bec6a6f1b4c1c2ff2db086b9996a2b42) +++ Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsInput.cs (.../GrassCoverErosionInwardsInput.cs) (revision 5294cbf38ddf4c3fdd7c37b78f1ab4fa89ad9b86) @@ -29,6 +29,7 @@ using Riskeer.Common.Data.DikeProfiles; using Riskeer.Common.Data.Hydraulics; using Riskeer.Common.Data.Probabilistics; +using Riskeer.GrassCoverErosionInwards.Data.Properties; using RiskeerCommonDataResources = Riskeer.Common.Data.Properties.Resources; namespace Riskeer.GrassCoverErosionInwards.Data @@ -40,18 +41,23 @@ { private const int orientationNumberOfDecimals = 2; - private static readonly Range orientationValidityRange = new Range(new RoundedDouble(orientationNumberOfDecimals), - new RoundedDouble(orientationNumberOfDecimals, 360)); + private static readonly Range orientationValidityRange = new Range( + new RoundedDouble(orientationNumberOfDecimals), + new RoundedDouble(orientationNumberOfDecimals, 360)); private LogNormalDistribution criticalFlowRate; private RoundedDouble orientation; private RoundedDouble dikeHeight; private DikeProfile dikeProfile; + private double dikeHeightReliabilityIndex; + private double overtoppingRateReliabilityIndex; /// /// Creates a new instance of . /// /// The norm to use. + /// Thrown when + /// is not in the interval {0.0, 0.1] or is . public GrassCoverErosionInwardsInput(double norm) { orientation = new RoundedDouble(orientationNumberOfDecimals); @@ -76,10 +82,7 @@ /// public DikeProfile DikeProfile { - get - { - return dikeProfile; - } + get => dikeProfile; set { dikeProfile = value; @@ -91,12 +94,11 @@ /// Gets or sets the orientation of the dike profile geometry with respect to North /// in degrees. A positive value equals a clockwise rotation. /// + /// Thrown when the new value + /// is not in the interval [0.00, 360.00] or is . public RoundedDouble Orientation { - get - { - return orientation; - } + get => orientation; set { RoundedDouble newOrientation = value.ToPrecision(orientation.NumberOfDecimalPlaces); @@ -119,38 +121,23 @@ /// and the succeeding . The roughness of the last /// point is irrelevant. /// - public IEnumerable DikeGeometry - { - get - { - return dikeProfile?.DikeGeometry ?? new RoughnessPoint[0]; - } - } + public IEnumerable DikeGeometry => dikeProfile?.DikeGeometry ?? new RoughnessPoint[0]; /// /// Gets or sets the height of the dike [m+NAP]. /// public RoundedDouble DikeHeight { - get - { - return dikeHeight; - } - set - { - dikeHeight = value.ToPrecision(dikeHeight.NumberOfDecimalPlaces); - } + get => dikeHeight; + set => dikeHeight = value.ToPrecision(dikeHeight.NumberOfDecimalPlaces); } /// /// Gets or sets the critical flow rate. /// public LogNormalDistribution CriticalFlowRate { - get - { - return criticalFlowRate; - } + get => criticalFlowRate; set { criticalFlowRate.Mean = value.Mean; @@ -171,12 +158,32 @@ /// /// Gets or sets the reliability index for the Dike Height calculation. /// - public double DikeHeightReliabilityIndex { get; set; } + /// Thrown when the new value + /// is not in the interval {0.0, 0.1] or is . + public double DikeHeightReliabilityIndex + { + get => dikeHeightReliabilityIndex; + set + { + ValidateReliabilityIndex(value); + dikeHeightReliabilityIndex = value; + } + } /// /// Gets or sets the reliability index for the Overtopping Rate calculation. /// - public double OvertoppingRateReliabilityIndex { get; set; } + /// Thrown when the new value + /// is not in the interval {0.0, 0.1] or is . + public double OvertoppingRateReliabilityIndex + { + get => overtoppingRateReliabilityIndex; + set + { + ValidateReliabilityIndex(value); + overtoppingRateReliabilityIndex = value; + } + } /// /// Gets or sets how the Dike Height should be calculated. @@ -239,15 +246,10 @@ public bool UseForeshore { get; set; } - public RoundedPoint2DCollection ForeshoreGeometry - { - get - { - return dikeProfile != null - ? dikeProfile.ForeshoreGeometry - : new RoundedPoint2DCollection(2, Enumerable.Empty()); - } - } + public RoundedPoint2DCollection ForeshoreGeometry => + dikeProfile != null + ? dikeProfile.ForeshoreGeometry + : new RoundedPoint2DCollection(2, Enumerable.Empty()); /// /// Applies the properties of the to the @@ -282,6 +284,16 @@ return clone; } + private static void ValidateReliabilityIndex(double reliabilityIndex) + { + if (double.IsNaN(reliabilityIndex) || reliabilityIndex <= 0 || reliabilityIndex > 0.1) + { + throw new ArgumentOutOfRangeException(nameof(reliabilityIndex), + reliabilityIndex, + Resources.ReliabilityIndex_Value_must_be_in_range); + } + } + private void SetDefaultDikeProfileProperties() { Orientation = RoundedDouble.NaN; Index: Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Data/Properties/Resources.Designer.cs =================================================================== diff -u -ra4e3b2745a48598260107bb5bfca7485205cdcc2 -r5294cbf38ddf4c3fdd7c37b78f1ab4fa89ad9b86 --- Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision a4e3b2745a48598260107bb5bfca7485205cdcc2) +++ Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 5294cbf38ddf4c3fdd7c37b78f1ab4fa89ad9b86) @@ -1,4 +1,4 @@ -// Copyright (C) Stichting Deltares 2021. All rights reserved. +// Copyright (C) Stichting Deltares 2021. All rights reserved. // // This file is part of Riskeer. // @@ -154,5 +154,14 @@ return ResourceManager.GetString("OvertoppingRateCalculationType_NoCalculation_DisplayName", resourceCulture); } } + + /// + /// Looks up a localized string similar to De waarde van de doelkans moet groter zijn dan 0.0 en kleiner dan of gelijk aan 0.1.. + /// + public static string ReliabilityIndex_Value_must_be_in_range { + get { + return ResourceManager.GetString("ReliabilityIndex_Value_must_be_in_range", resourceCulture); + } + } } } Index: Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Data/Properties/Resources.resx =================================================================== diff -u -rbf1fde9d2147a6eeaecebbb371be2c4856759159 -r5294cbf38ddf4c3fdd7c37b78f1ab4fa89ad9b86 --- Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Data/Properties/Resources.resx (.../Resources.resx) (revision bf1fde9d2147a6eeaecebbb371be2c4856759159) +++ Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Data/Properties/Resources.resx (.../Resources.resx) (revision 5294cbf38ddf4c3fdd7c37b78f1ab4fa89ad9b86) @@ -141,4 +141,7 @@ Niet + + De waarde van de doelkans moet groter zijn dan 0.0 en kleiner dan of gelijk aan 0.1. + \ No newline at end of file