Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/DeterministicHydraRingVariable.cs =================================================================== diff -u -r359027c5043e8eddd84cbd99fd5b6a603e391fe6 -r6fa6777d83fb74d42f0584ec98f04f1fbede993c --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/DeterministicHydraRingVariable.cs (.../DeterministicHydraRingVariable.cs) (revision 359027c5043e8eddd84cbd99fd5b6a603e391fe6) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/DeterministicHydraRingVariable.cs (.../DeterministicHydraRingVariable.cs) (revision 6fa6777d83fb74d42f0584ec98f04f1fbede993c) @@ -26,14 +26,27 @@ /// public class DeterministicHydraRingVariable : HydraRingVariable2 { + private readonly double value; + /// /// Creates a new instance of . /// /// The Hydra-Ring id corresponding to the variable that is considered. - /// The value in case the variable is deterministic. - public DeterministicHydraRingVariable(int variableId, double value) - : base(variableId, value, HydraRingDeviationType.Standard) {} + /// The value of the variable. + public DeterministicHydraRingVariable(int variableId, double value) + : base(variableId, HydraRingDeviationType.Standard) + { + this.value = value; + } + public override double Value + { + get + { + return value; + } + } + public override HydraRingDistributionType DistributionType { get Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/HydraRingVariable2.cs =================================================================== diff -u -r359027c5043e8eddd84cbd99fd5b6a603e391fe6 -r6fa6777d83fb74d42f0584ec98f04f1fbede993c --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/HydraRingVariable2.cs (.../HydraRingVariable2.cs) (revision 359027c5043e8eddd84cbd99fd5b6a603e391fe6) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/HydraRingVariable2.cs (.../HydraRingVariable2.cs) (revision 6fa6777d83fb74d42f0584ec98f04f1fbede993c) @@ -30,19 +30,16 @@ private readonly double? defaultHydraRingNullValue = null; private readonly int variableId; - private readonly double value; private readonly HydraRingDeviationType deviationType; /// /// Creates a new instance of the class. /// /// The Hydra-Ring id corresponding to the variable that is considered. - /// The value in case the variable is deterministic. /// The deviation type in case the variable is random. - protected HydraRingVariable2(int variableId, double value, HydraRingDeviationType deviationType) + protected HydraRingVariable2(int variableId, HydraRingDeviationType deviationType) { this.variableId = variableId; - this.value = value; this.deviationType = deviationType; } @@ -63,11 +60,11 @@ /// /// This property is only relevant when equals . /// - public double Value + public virtual double Value { get { - return value; + return defaultHydraRingValue; } } Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/NormalHydraRingVariable.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/NormalHydraRingVariable.cs (revision 0) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/NormalHydraRingVariable.cs (revision 6fa6777d83fb74d42f0584ec98f04f1fbede993c) @@ -0,0 +1,83 @@ +// 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. + +namespace Ringtoets.HydraRing.Calculation.Data +{ + /// + /// Class for Normal Hydra-Ring variable related data. + /// + public class NormalHydraRingVariable : HydraRingVariable2 + { + private readonly double parameter1; + private readonly double parameter2; + + /// + /// Creates a new instance of . + /// + /// The Hydra-Ring id corresponding to the variable that is considered. + /// The deviation type in case the variable is random. + /// The parameter1 value of the variable. + /// The parameter2 value of the variable. + public NormalHydraRingVariable(int variableId, HydraRingDeviationType deviationType, + double parameter1, double parameter2) + : base(variableId, deviationType) + { + this.parameter1 = parameter1; + this.parameter2 = parameter2; + } + + public override double Parameter1 + { + get + { + return parameter1; + } + } + + public override double? Parameter2 + { + get + { + return DeviationType == HydraRingDeviationType.Standard + ? parameter2 + : base.Parameter2; + } + } + + public override double CoefficientOfVariation + { + get + { + return DeviationType == HydraRingDeviationType.Variation + ? parameter2 + : base.CoefficientOfVariation; + } + } + + public override HydraRingDistributionType DistributionType + { + get + { + return HydraRingDistributionType.Normal; + } + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj =================================================================== diff -u -r359027c5043e8eddd84cbd99fd5b6a603e391fe6 -r6fa6777d83fb74d42f0584ec98f04f1fbede993c --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision 359027c5043e8eddd84cbd99fd5b6a603e391fe6) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision 6fa6777d83fb74d42f0584ec98f04f1fbede993c) @@ -91,6 +91,7 @@ + Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/HydraRingVariable2Test.cs =================================================================== diff -u -r359027c5043e8eddd84cbd99fd5b6a603e391fe6 -r6fa6777d83fb74d42f0584ec98f04f1fbede993c --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/HydraRingVariable2Test.cs (.../HydraRingVariable2Test.cs) (revision 359027c5043e8eddd84cbd99fd5b6a603e391fe6) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/HydraRingVariable2Test.cs (.../HydraRingVariable2Test.cs) (revision 6fa6777d83fb74d42f0584ec98f04f1fbede993c) @@ -31,11 +31,11 @@ public void Constructor_ExpectedValues() { // Call - var hydraRingVariable = new TestHydraRingVariable(1, 2.2, HydraRingDeviationType.Variation); + var hydraRingVariable = new TestHydraRingVariable(1, HydraRingDeviationType.Variation); // Assert Assert.AreEqual(1, hydraRingVariable.VariableId); - Assert.AreEqual(2.2, hydraRingVariable.Value); + Assert.AreEqual(0, hydraRingVariable.Value); Assert.AreEqual(HydraRingDeviationType.Variation, hydraRingVariable.DeviationType); Assert.AreEqual(0, hydraRingVariable.Parameter1); Assert.IsNull(hydraRingVariable.Parameter2); @@ -46,8 +46,8 @@ private class TestHydraRingVariable : HydraRingVariable2 { - public TestHydraRingVariable(int variableId, double value, HydraRingDeviationType deviationType) - : base(variableId, value, deviationType) {} + public TestHydraRingVariable(int variableId, HydraRingDeviationType deviationType) + : base(variableId, deviationType) {} public override HydraRingDistributionType DistributionType { Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/NormalHydraRingVariableTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/NormalHydraRingVariableTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/NormalHydraRingVariableTest.cs (revision 6fa6777d83fb74d42f0584ec98f04f1fbede993c) @@ -0,0 +1,50 @@ +// 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 NUnit.Framework; +using Ringtoets.HydraRing.Calculation.Data; + +namespace Ringtoets.HydraRing.Calculation.Test.Data +{ + [TestFixture] + public class NormalHydraRingVariableTest + { + [Test] + [TestCase(HydraRingDeviationType.Standard, 3.3, 0)] + [TestCase(HydraRingDeviationType.Variation, null, 3.3)] + public void Constructor_ExpectedValues(HydraRingDeviationType deviationType, double? expectedParameter2, double expectedCoefficientOfVariation) + { + // Call + var hydraRingVariable = new NormalHydraRingVariable(1, deviationType, 2.2, 3.3); + + // Assert + Assert.IsInstanceOf(hydraRingVariable); + Assert.AreEqual(1, hydraRingVariable.VariableId); + Assert.AreEqual(HydraRingDistributionType.Normal, hydraRingVariable.DistributionType); + Assert.AreEqual(deviationType, hydraRingVariable.DeviationType); + Assert.AreEqual(2.2, hydraRingVariable.Parameter1); + Assert.AreEqual(expectedParameter2, hydraRingVariable.Parameter2); + Assert.IsNull(hydraRingVariable.Parameter3); + Assert.IsNull(hydraRingVariable.Parameter4); + Assert.AreEqual(expectedCoefficientOfVariation, hydraRingVariable.CoefficientOfVariation); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj =================================================================== diff -u -r359027c5043e8eddd84cbd99fd5b6a603e391fe6 -r6fa6777d83fb74d42f0584ec98f04f1fbede993c --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj (.../Ringtoets.HydraRing.Calculation.Test.csproj) (revision 359027c5043e8eddd84cbd99fd5b6a603e391fe6) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj (.../Ringtoets.HydraRing.Calculation.Test.csproj) (revision 6fa6777d83fb74d42f0584ec98f04f1fbede993c) @@ -90,6 +90,7 @@ +