Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsStochasticSoilProfile.cs =================================================================== diff -u -r74be63b9f6ac8bc60a6754667a3bcee0485853a0 -r8cbe9f4263082b2a7199fa4643f32a09b025d2ec --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsStochasticSoilProfile.cs (.../MacroStabilityInwardsStochasticSoilProfile.cs) (revision 74be63b9f6ac8bc60a6754667a3bcee0485853a0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsStochasticSoilProfile.cs (.../MacroStabilityInwardsStochasticSoilProfile.cs) (revision 8cbe9f4263082b2a7199fa4643f32a09b025d2ec) @@ -40,29 +40,25 @@ /// Creates a new instance of . /// /// Probability of the stochastic soil profile. - /// Type of the stochastic soil profile. - /// Database identifier of the stochastic soil profile. - public MacroStabilityInwardsStochasticSoilProfile(double probability, SoilProfileType soilProfileType, long soilProfileId) + /// The soil profile. + /// Thrown when + /// is null. + /// Thrown when the + /// is outside the range [0, 1]. + public MacroStabilityInwardsStochasticSoilProfile(double probability, IMacroStabilityInwardsSoilProfile soilProfile) { + if (soilProfile == null) + { + throw new ArgumentNullException(nameof(soilProfile)); + } Probability = probability; - SoilProfileType = soilProfileType; - SoilProfileId = soilProfileId; + SoilProfile = soilProfile; } /// - /// Gets the type of the stochastic soil profile. - /// - public SoilProfileType SoilProfileType { get; private set; } - - /// - /// Gets the database identifier of the stochastic soil profile. - /// - public long SoilProfileId { get; } - - /// /// Gets the . /// - public IMacroStabilityInwardsSoilProfile SoilProfile { get; set; } + public IMacroStabilityInwardsSoilProfile SoilProfile { get; private set; } /// /// Gets the probability of the stochastic soil profile. @@ -118,7 +114,6 @@ if (!Equals(fromProfile)) { SoilProfile = fromProfile.SoilProfile; - SoilProfileType = fromProfile.SoilProfileType; Probability = fromProfile.Probability; return true; } @@ -132,9 +127,18 @@ public override bool Equals(object obj) { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != GetType()) return false; + if (ReferenceEquals(null, obj)) + { + return false; + } + if (ReferenceEquals(this, obj)) + { + return true; + } + if (obj.GetType() != GetType()) + { + return false; + } return Equals((MacroStabilityInwardsStochasticSoilProfile) obj); } @@ -143,7 +147,6 @@ unchecked { int hashCode = Probability.GetHashCode(); - hashCode = (hashCode * 397) ^ (int) SoilProfileType; hashCode = (hashCode * 397) ^ (SoilProfile?.GetHashCode() ?? 0); return hashCode; } @@ -152,7 +155,6 @@ private bool Equals(MacroStabilityInwardsStochasticSoilProfile other) { return Probability.Equals(other.Probability) - && SoilProfileType == other.SoilProfileType && Equals(SoilProfile, other.SoilProfile); } }