Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/HeightStructuresImporter.cs =================================================================== diff -u -r58c471864c590aff4b609e7c2df36a220bf390b1 -r250f2f821d2540a5c562d5fa9ccaab669dacb24b --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/HeightStructuresImporter.cs (.../HeightStructuresImporter.cs) (revision 58c471864c590aff4b609e7c2df36a220bf390b1) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/HeightStructuresImporter.cs (.../HeightStructuresImporter.cs) (revision 250f2f821d2540a5c562d5fa9ccaab669dacb24b) @@ -37,24 +37,37 @@ /// public class HeightStructuresImporter : StructuresImporter> { + private readonly IStructureUpdateStrategy structureUpdateStrategy; + /// /// Creates a new instance of . /// /// The height structures to import on. /// The reference line used to check if the /// objects found in the file are intersecting it. + /// The strategy to update the structures with imported data. /// The path to the file to import from. - /// Thrown when , - /// or is null. - public HeightStructuresImporter(StructureCollection importTarget, - ReferenceLine referenceLine, string filePath) - : base(importTarget, referenceLine, filePath) {} + /// Thrown when any of the input parameters is null. + public HeightStructuresImporter(StructureCollection importTarget, ReferenceLine referenceLine, + IStructureUpdateStrategy structureUpdateStrategy, + string filePath) + : base(importTarget, referenceLine, filePath) + { + if (structureUpdateStrategy == null) + { + throw new ArgumentNullException(nameof(structureUpdateStrategy)); + } + this.structureUpdateStrategy = structureUpdateStrategy; + } + protected override void CreateSpecificStructures(ICollection structureLocations, Dictionary> groupedStructureParameterRows) { - ImportTarget.AddRange(CreateHeightStructures(structureLocations.ToList(), groupedStructureParameterRows).ToArray(), - FilePath); + structureUpdateStrategy.UpdateStructuresWithImportedData(ImportTarget, + CreateHeightStructures(structureLocations.ToList(), + groupedStructureParameterRows).ToArray(), + FilePath); } private IEnumerable CreateHeightStructures(IEnumerable structureLocations,