Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/HydraRingConfiguration.cs =================================================================== diff -u -r23138b2af6c2ccccc60c0e081f398a1c0fdce7af -r907f25f4a15204ce1b1ba29d0ada4410d1914930 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/HydraRingConfiguration.cs (.../HydraRingConfiguration.cs) (revision 23138b2af6c2ccccc60c0e081f398a1c0fdce7af) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/HydraRingConfiguration.cs (.../HydraRingConfiguration.cs) (revision 907f25f4a15204ce1b1ba29d0ada4410d1914930) @@ -25,6 +25,7 @@ using System.Globalization; using System.Linq; using Ringtoets.HydraRing.Calculation.Data; +using Ringtoets.HydraRing.Calculation.Types; namespace Ringtoets.HydraRing.Calculation { @@ -40,7 +41,7 @@ public class HydraRingConfiguration { private readonly IList hydraRingCalculations; - private readonly IEnumerable defaultsPerFailureMechanism; + private readonly IDictionary defaultsPerFailureMechanism; private readonly IEnumerable configurationPerSubMechanism; /// @@ -50,67 +51,97 @@ { hydraRingCalculations = new List(); - defaultsPerFailureMechanism = new[] + defaultsPerFailureMechanism = new Dictionary { - new HydraRingConfigurationDefaults(HydraRingFailureMechanismType.AssessmentLevel, 2, 26, new[] { - 1 - }), - new HydraRingConfigurationDefaults(HydraRingFailureMechanismType.WaveHeight, 2, 28, new[] + HydraRingFailureMechanismType.AssessmentLevel, + new DefaultsPerFailureMechanism(1, 2, 26, new[] + { + 1 + }) + }, { - 11 - }), - new HydraRingConfigurationDefaults(HydraRingFailureMechanismType.WavePeakPeriod, 2, 29, new[] + HydraRingFailureMechanismType.WaveHeight, + new DefaultsPerFailureMechanism(11, 2, 28, new[] + { + 11 + }) + }, { - 14 - }), - new HydraRingConfigurationDefaults(HydraRingFailureMechanismType.WaveSpectralPeriod, 2, 29, new[] + HydraRingFailureMechanismType.WavePeakPeriod, + new DefaultsPerFailureMechanism(11, 2, 29, new[] + { + 14 + }) + }, { - 16 - }), - new HydraRingConfigurationDefaults(HydraRingFailureMechanismType.QVariant, 6, 114, new[] + HydraRingFailureMechanismType.WaveSpectralPeriod, + new DefaultsPerFailureMechanism(11, 2, 29, new[] + { + 16 + }) + }, { - 3, - 4, - 5 - }), - new HydraRingConfigurationDefaults(HydraRingFailureMechanismType.DikesOvertopping, 1, 1, new[] + HydraRingFailureMechanismType.QVariant, + new DefaultsPerFailureMechanism(3, 6, 114, new[] + { + 3, + 4, + 5 + }) + }, { - 102, - 103 - }), - new HydraRingConfigurationDefaults(HydraRingFailureMechanismType.DikesPiping, 1, 44, new[] + HydraRingFailureMechanismType.DikesOvertopping, + new DefaultsPerFailureMechanism(101, 1, 1, new[] + { + 102, + 103 + }) + }, { - 311, - 313, - 314 - }), - new HydraRingConfigurationDefaults(HydraRingFailureMechanismType.StructuresOvertopping, 1, 60, new[] + HydraRingFailureMechanismType.DikesPiping, + new DefaultsPerFailureMechanism(103, 1, 44, new[] + { + 311, + 313, + 314 + }) + }, { - 421, - 422, - 423 - }), - new HydraRingConfigurationDefaults(HydraRingFailureMechanismType.StructuresClosure, 1, 65, new[] + HydraRingFailureMechanismType.StructuresOvertopping, + new DefaultsPerFailureMechanism(110, 1, 60, new[] + { + 421, + 422, + 423 + }) + }, { - 422, - 424, - 425, - 426, - 427 - }), - new HydraRingConfigurationDefaults(HydraRingFailureMechanismType.StructuresStructuralFailure, 1, 65, new[] + HydraRingFailureMechanismType.StructuresClosure, + new DefaultsPerFailureMechanism(111, 1, 65, new[] + { + 422, + 424, + 425, + 426, + 427 + }) + }, { - 422, - 424, - 425, - 430, - 431, - 432, - 433, - 434, - 435 - }) + HydraRingFailureMechanismType.StructuresStructuralFailure, + new DefaultsPerFailureMechanism(112, 1, 65, new[] + { + 422, + 424, + 425, + 430, + 431, + 432, + 433, + 434, + 435 + }) + } }; configurationPerSubMechanism = new[] @@ -788,15 +819,15 @@ foreach (var hydraRingCalculation in hydraRingCalculations) { - var defaultsForFailureMechanism = defaultsPerFailureMechanism.First(cs => cs.FailureMechanismType == hydraRingCalculation.FailureMechanismType); + var defaultsForFailureMechanism = defaultsPerFailureMechanism[hydraRingCalculation.FailureMechanismType]; orderedDictionaries.Add(new OrderedDictionary { { "SectionId", 999 // TODO: Dike section integration }, { - "MechanismId", (int?) hydraRingCalculation.FailureMechanismType + "MechanismId", defaultsForFailureMechanism.MechanismId }, { "LayerId", null // Fixed: no support for revetments @@ -843,7 +874,7 @@ foreach (var hydraRingCalculation in hydraRingCalculations) { - var defaultsForFailureMechanism = defaultsPerFailureMechanism.First(cs => cs.FailureMechanismType == hydraRingCalculation.FailureMechanismType); + var defaultsForFailureMechanism = defaultsPerFailureMechanism[hydraRingCalculation.FailureMechanismType]; foreach (var subMechanimsId in defaultsForFailureMechanism.SubMechanismIds) { @@ -855,7 +886,7 @@ "SectionId", 999 // TODO: Dike section integration }, { - "MechanismId", (int?) hydraRingCalculation.FailureMechanismType + "MechanismId", defaultsForFailureMechanism.MechanismId }, { "LayerId", null // Fixed: no support for revetments @@ -1010,43 +1041,43 @@ # region Nested types /// - /// Container for default Hydra-Ring configuration settings. + /// Container for default Hydra-Ring settings on a per basis. /// - private class HydraRingConfigurationDefaults + private class DefaultsPerFailureMechanism { private readonly int variableId; + private readonly int mechanismId; private readonly int calculationTypeId; private readonly IEnumerable subMechanismIds; - private readonly HydraRingFailureMechanismType hydraRingFailureMechanismType; /// - /// Creates a new instance of the class. + /// Creates a new instance of the class. /// - /// The . + /// The corresponding mechanism id. /// The corresponding calculation type id. /// The corresponding variable id. /// The corresponding sub mechanism ids. - public HydraRingConfigurationDefaults(HydraRingFailureMechanismType hydraRingFailureMechanismType, int calculationTypeId, int variableId, IEnumerable subMechanismIds) + public DefaultsPerFailureMechanism(int mechanismId, int calculationTypeId, int variableId, IEnumerable subMechanismIds) { + this.mechanismId = mechanismId; this.variableId = variableId; this.calculationTypeId = calculationTypeId; this.subMechanismIds = subMechanismIds; - this.hydraRingFailureMechanismType = hydraRingFailureMechanismType; } /// - /// Gets the . + /// Gets the mechanism id that corresponds to a specific . /// - public HydraRingFailureMechanismType FailureMechanismType + public int MechanismId { get { - return hydraRingFailureMechanismType; + return mechanismId; } } /// - /// Gets the calculation type id that is applicable for the specified . + /// Gets the calculation type id that is applicable for a specific . /// public int CalculationTypeId { @@ -1057,7 +1088,7 @@ } /// - /// Gets the id of the variable that is relevant for the specified . + /// Gets the id of the variable that is relevant for a specific . /// public int VariableId { @@ -1068,7 +1099,7 @@ } /// - /// Gets the sub mechanism ids that are applicable for the specified . + /// Gets the sub mechanism ids that are applicable for a specific . /// public IEnumerable SubMechanismIds {