Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/HydraRingVariable.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/HydraRingVariable.cs (revision 0) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/HydraRingVariable.cs (revision 02e4e3830d745db66a35986a2ffdfb9e484ad48a) @@ -0,0 +1,167 @@ +// 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 Ringtoets.HydraRing.Calculation.Types; + +namespace Ringtoets.HydraRing.Calculation.Data +{ + /// + /// Container for Hydra-Ring variable related data. + /// + internal abstract class HydraRingVariable + { + private readonly int variableId; + private readonly HydraRingDistributionType distributionType; + private readonly double value; + private readonly HydraRingDeviationType deviationType; + private readonly double mean; + private readonly double variability; + private readonly double shift; + private readonly double correlationLength; + + /// + /// Creates a new instance of the class. + /// + /// The Hydra-Ring id corresponding to the variable that is considered. + /// The probability distribution of the variable. + /// The value in case the variable is deterministic. + /// The deviation type in case the variable is random. + /// The mean value in case the variable is random. + /// The variability in case the variable is random. + /// The shift in case the variable is random. + /// The correlation length. + protected HydraRingVariable(int variableId, HydraRingDistributionType distributionType, double value, HydraRingDeviationType deviationType, double mean, double variability, double shift, double correlationLength) + { + this.variableId = variableId; + this.distributionType = distributionType; + this.value = value; + this.deviationType = deviationType; + this.mean = mean; + this.variability = variability; + this.shift = shift; + this.correlationLength = correlationLength; + } + + /// + /// Gets the Hydra-Ring id corresponding to the variable that is considered. + /// + public int VariableId + { + get + { + return variableId; + } + } + + /// + /// Gets the probability distribution of the variable. + /// + public HydraRingDistributionType DistributionType + { + get + { + return distributionType; + } + } + + /// + /// Gets the value in case the variable is deterministic. + /// + /// + /// This property is only relevant when equals . + /// + public double Value + { + get + { + return value; + } + } + + /// + /// Gets the deviation type in case the variable is random. + /// + /// + /// This property is only relevant when is not equal to . + /// + public HydraRingDeviationType DeviationType + { + get + { + return deviationType; + } + } + + /// + /// Gets the mean value in case the variable is random. + /// + /// + /// This property is only relevant when is not equal to . + /// + public double Mean + { + get + { + return mean; + } + } + + /// + /// Gets the variablity in case the variable is random. + /// + /// + /// The value represents a standard deviation in case the equals . + /// The value represents a variation coefficient in case the equals . + /// + public double Variability + { + get + { + return variability; + } + } + + /// + /// Gets the shift in case the variable is random. + /// + /// + /// This property is only relevant when equals . + /// + public double Shift + { + get + { + return shift; + } + } + + /// + /// Gets the correlation length. + /// + public double CorrelationLength + { + get + { + return correlationLength; + } + } + } +} Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj =================================================================== diff -u -r0807ea5c37a7436c1984ba931dab56887ab53762 -r02e4e3830d745db66a35986a2ffdfb9e484ad48a --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision 0807ea5c37a7436c1984ba931dab56887ab53762) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision 02e4e3830d745db66a35986a2ffdfb9e484ad48a) @@ -41,6 +41,9 @@ + + + Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Types/HydraRingDeviationType.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Types/HydraRingDeviationType.cs (revision 0) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Types/HydraRingDeviationType.cs (revision 02e4e3830d745db66a35986a2ffdfb9e484ad48a) @@ -0,0 +1,14 @@ +namespace Ringtoets.HydraRing.Calculation.Types +{ + /// + /// Enumeration that defines the deviation types supported by Hydra-Ring. + /// + /// + /// The integer values correspond to deviation ids defined within Hydra-Ring. + /// + public enum HydraRingDeviationType + { + Standard = 0, + Variation = 1 + } +} \ No newline at end of file Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Types/HydraRingDistributionType.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Types/HydraRingDistributionType.cs (revision 0) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Types/HydraRingDistributionType.cs (revision 02e4e3830d745db66a35986a2ffdfb9e484ad48a) @@ -0,0 +1,15 @@ +namespace Ringtoets.HydraRing.Calculation.Types +{ + /// + /// Enumeration that defines the distribution types supported by Hydra-Ring. + /// + /// + /// The integer values correspond to distribution ids defined within Hydra-Ring. + /// + public enum HydraRingDistributionType + { + Deterministic = 0, + Normal = 2, + LogNormal = 4 // Also applies to shifted log normal distributions + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj =================================================================== diff -u -re6f8ac7ecbea09b8c7500713e9c2a48844b67eed -r02e4e3830d745db66a35986a2ffdfb9e484ad48a --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj (.../Ringtoets.HydraRing.Calculation.Test.csproj) (revision e6f8ac7ecbea09b8c7500713e9c2a48844b67eed) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj (.../Ringtoets.HydraRing.Calculation.Test.csproj) (revision 02e4e3830d745db66a35986a2ffdfb9e484ad48a) @@ -55,6 +55,8 @@ + + Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Types/HydraRingDeviationTypeTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Types/HydraRingDeviationTypeTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Types/HydraRingDeviationTypeTest.cs (revision 02e4e3830d745db66a35986a2ffdfb9e484ad48a) @@ -0,0 +1,44 @@ +// 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 NUnit.Framework; +using Ringtoets.HydraRing.Calculation.Types; + +namespace Ringtoets.HydraRing.Calculation.Test.Types +{ + [TestFixture] + public class HydraRingDeviationTypeTest + { + [Test] + public void Values_HasTwo() + { + Assert.AreEqual(2, Enum.GetValues(typeof(HydraRingDeviationType)).Length); + } + + [Test] + public void ConvertToInteger_ForAllValues_ReturnsExpectedInteger() + { + Assert.AreEqual(0, (int) HydraRingDeviationType.Standard); + Assert.AreEqual(1, (int) HydraRingDeviationType.Variation); + } + } +} Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Types/HydraRingDistributionTypeTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Types/HydraRingDistributionTypeTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Types/HydraRingDistributionTypeTest.cs (revision 02e4e3830d745db66a35986a2ffdfb9e484ad48a) @@ -0,0 +1,45 @@ +// 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 NUnit.Framework; +using Ringtoets.HydraRing.Calculation.Types; + +namespace Ringtoets.HydraRing.Calculation.Test.Types +{ + [TestFixture] + public class HydraRingDistributionTypeTest + { + [Test] + public void Values_HasThree() + { + Assert.AreEqual(3, Enum.GetValues(typeof(HydraRingDistributionType)).Length); + } + + [Test] + public void ConvertToInteger_ForAllValues_ReturnsExpectedInteger() + { + Assert.AreEqual(0, (int) HydraRingDistributionType.Deterministic); + Assert.AreEqual(2, (int) HydraRingDistributionType.Normal); + Assert.AreEqual(4, (int) HydraRingDistributionType.LogNormal); + } + } +}