Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsStochasticSoilModel.cs =================================================================== diff -u -rb1cb91cbc7d2332a1a82c5d1361c25cd5a4a6ddc -rb13759ad077f9e2b4104de000b5bdeafa9abe358 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsStochasticSoilModel.cs (.../MacroStabilityInwardsStochasticSoilModel.cs) (revision b1cb91cbc7d2332a1a82c5d1361c25cd5a4a6ddc) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsStochasticSoilModel.cs (.../MacroStabilityInwardsStochasticSoilModel.cs) (revision b13759ad077f9e2b4104de000b5bdeafa9abe358) @@ -35,14 +35,19 @@ /// public class MacroStabilityInwardsStochasticSoilModel : Observable, IMechanismStochasticSoilModel { + private readonly List stochasticSoilProfiles = new List(); + /// /// Creates a new instance of . /// /// Name of the segment soil model. /// The geometry of the segment soil model. + /// The stochastic soil profiles of the segment soil model. /// Thrown when any parameter is null. /// Thrown when is empty. - public MacroStabilityInwardsStochasticSoilModel(string name, IEnumerable geometry) + public MacroStabilityInwardsStochasticSoilModel(string name, + IEnumerable geometry, + IEnumerable stochasticSoilProfiles) { if (name == null) { @@ -52,6 +57,10 @@ { throw new ArgumentNullException(nameof(geometry)); } + if (stochasticSoilProfiles == null) + { + throw new ArgumentNullException(nameof(stochasticSoilProfiles)); + } if (!geometry.Any()) { string message = string.Format(RingtoetsCommonDataResources.StochasticSoilModel_Geometry_of_StochasticSoilModelName_0_must_contain_a_geometry, name); @@ -60,7 +69,7 @@ Name = name; Geometry = geometry; - StochasticSoilProfiles = new List(); + this.stochasticSoilProfiles.AddRange(stochasticSoilProfiles); } /// @@ -69,14 +78,20 @@ public string Name { get; private set; } /// - /// Gets the list of geometry points. + /// Gets the geometry points. /// public IEnumerable Geometry { get; private set; } /// - /// Gets the list of . + /// Gets the the collection of . /// - public List StochasticSoilProfiles { get; } + public IEnumerable StochasticSoilProfiles + { + get + { + return stochasticSoilProfiles; + } + } /// /// Updates the with the properties @@ -99,7 +114,7 @@ Name = fromModel.Name; Geometry = fromModel.Geometry; - + var newSoilProfiles = new List(); var updatedProfiles = new List(); var addedProfiles = new List(); @@ -120,7 +135,7 @@ } else { - StochasticSoilProfiles.Add(fromProfile); + stochasticSoilProfiles.Add(fromProfile); addedProfiles.Add(fromProfile); } newSoilProfiles.Add(fromProfile.SoilProfile); @@ -129,7 +144,7 @@ foreach (MacroStabilityInwardsStochasticSoilProfile profileToRemove in StochasticSoilProfiles.Where( sp => !newSoilProfiles.Any(newSp => IsSame(newSp, sp.SoilProfile))).ToArray()) { - StochasticSoilProfiles.Remove(profileToRemove); + stochasticSoilProfiles.Remove(profileToRemove); removedProfiles.Add(profileToRemove); }