Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ReadConversionCollector.cs =================================================================== diff -u -r4f89601cb9d77ff379727afd64f902a0aff74fa3 -r6e33ada58f1a53a5a732c3b4e46583ad846a2983 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ReadConversionCollector.cs (.../ReadConversionCollector.cs) (revision 4f89601cb9d77ff379727afd64f902a0aff74fa3) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ReadConversionCollector.cs (.../ReadConversionCollector.cs) (revision 6e33ada58f1a53a5a732c3b4e46583ad846a2983) @@ -42,22 +42,54 @@ /// internal class ReadConversionCollector { - private readonly Dictionary stochasticSoilModels = CreateDictionary(); - private readonly Dictionary stochasticSoilProfiles = CreateDictionary(); - private readonly Dictionary soilProfiles = CreateDictionary(); - private readonly Dictionary surfaceLines = CreateDictionary(); - private readonly Dictionary hydraulicBoundaryLocations = CreateDictionary(); - private readonly Dictionary grassCoverErosionOutwardsHydraulicBoundaryLocations = CreateDictionary(); - private readonly Dictionary failureMechanismSections = CreateDictionary(); - private readonly Dictionary dikeProfiles = CreateDictionary(); - private readonly Dictionary foreshoreProfiles = CreateDictionary(); - private readonly Dictionary grassCoverErosionInwardsCalculations = CreateDictionary(); - private readonly Dictionary heightStructures = CreateDictionary(); - private readonly Dictionary closingStructures = CreateDictionary(); - private readonly Dictionary stabilityPointStructures = CreateDictionary(); - private readonly Dictionary> heightStructuresCalculations = CreateDictionary>(); - private readonly Dictionary> closingStructuresCalculations = CreateDictionary>(); + private readonly Dictionary stochasticSoilModels = + CreateDictionary(); + private readonly Dictionary stochasticSoilProfiles = + CreateDictionary(); + + private readonly Dictionary soilProfiles = + CreateDictionary(); + + private readonly Dictionary surfaceLines = + CreateDictionary(); + + private readonly Dictionary hydraulicBoundaryLocations = + CreateDictionary(); + + private readonly Dictionary grassCoverErosionOutwardsHydraulicBoundaryLocations = + CreateDictionary(); + + private readonly Dictionary failureMechanismSections = + CreateDictionary(); + + private readonly Dictionary dikeProfiles = + CreateDictionary(); + + private readonly Dictionary foreshoreProfiles = + CreateDictionary(); + + private readonly Dictionary grassCoverErosionInwardsCalculations = + CreateDictionary(); + + private readonly Dictionary heightStructures = + CreateDictionary(); + + private readonly Dictionary closingStructures = + CreateDictionary(); + + private readonly Dictionary stabilityPointStructures = + CreateDictionary(); + + private readonly Dictionary> heightStructuresCalculations = + CreateDictionary>(); + + private readonly Dictionary> closingStructuresCalculations = + CreateDictionary>(); + + private readonly Dictionary> stabilityPointStructuresCalculations = + CreateDictionary>(); + private static Dictionary CreateDictionary() { return new Dictionary(new ReferenceEqualityComparer()); @@ -1140,5 +1172,76 @@ } #endregion + + #region StabilityPointStructuresCalculationEntity: Read, Contains, Get + + /// + /// Registers a read operation for + /// and the that was constructed + /// with the information. + /// + /// The + /// that was read. + /// The that + /// was constructed. + /// Thrown when any input parameter is null. + internal void Read(StabilityPointStructuresCalculationEntity entity, StructuresCalculation model) + { + if (entity == null) + { + throw new ArgumentNullException("entity"); + } + if (model == null) + { + throw new ArgumentNullException("model"); + } + + stabilityPointStructuresCalculations[entity] = model; + } + + /// + /// Checks whether a read operation has been registered for a given . + /// + /// The to check for. + /// true if the was read before, false otherwise. + /// Thrown when is null. + internal bool Contains(StabilityPointStructuresCalculationEntity entity) + { + if (entity == null) + { + throw new ArgumentNullException("entity"); + } + return stabilityPointStructuresCalculations.ContainsKey(entity); + } + + /// + /// Obtains the which was read + /// for the given . + /// + /// The for which a read + /// operation has been registered. + /// The constructed . + /// Thrown when is null. + /// Thrown when no read operation has + /// been registered for . + /// Use + /// to find out whether a read operation has been registered for . + internal StructuresCalculation Get(StabilityPointStructuresCalculationEntity entity) + { + if (entity == null) + { + throw new ArgumentNullException("entity"); + } + try + { + return stabilityPointStructuresCalculations[entity]; + } + catch (KeyNotFoundException e) + { + throw new InvalidOperationException(e.Message, e); + } + } + + #endregion } } \ No newline at end of file