Index: DamEngine/trunk/src/Deltares.DamEngine.Data/General/Segment.cs =================================================================== diff -u -r3893 -r4000 --- DamEngine/trunk/src/Deltares.DamEngine.Data/General/Segment.cs (.../Segment.cs) (revision 3893) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/General/Segment.cs (.../Segment.cs) (revision 4000) @@ -49,7 +49,7 @@ { get { - return this.soilGeometryProbabilities; + return soilGeometryProbabilities; } } @@ -60,15 +60,13 @@ /// public SoilProfile1D GetMostProbableProfile1D(SegmentFailureMechanismType? segmentFailureMechanismType) { - var mostProbableSoilGeometryProbability = GetMostProbableSoilGeometryProbability(segmentFailureMechanismType); + SoilGeometryProbability mostProbableSoilGeometryProbability = GetMostProbableSoilGeometryProbability(segmentFailureMechanismType); if (mostProbableSoilGeometryProbability != null && mostProbableSoilGeometryProbability.SoilProfileType == SoilProfileType.ProfileType1D) { return mostProbableSoilGeometryProbability?.SoilProfile1D; } - else - { - return null; - } + + return null; } /// @@ -78,15 +76,13 @@ /// public string GetMostProbableProfile2DStiFileName(SegmentFailureMechanismType? segmentFailureMechanismType) { - var mostProbableSoilGeometryProbability = GetMostProbableSoilGeometryProbability(segmentFailureMechanismType); + SoilGeometryProbability mostProbableSoilGeometryProbability = GetMostProbableSoilGeometryProbability(segmentFailureMechanismType); if (mostProbableSoilGeometryProbability != null && mostProbableSoilGeometryProbability.SoilProfileType == SoilProfileType.ProfileTypeStiFile) { return mostProbableSoilGeometryProbability?.FullStiFileName; } - else - { - return null; - } + + return null; } /// @@ -96,14 +92,16 @@ /// public SoilGeometryProbability GetMostProbableSoilGeometryProbability(SegmentFailureMechanismType? segmentFailureMechanismType) { - IEnumerable spps = from SoilGeometryProbability spp in this.soilGeometryProbabilities + IEnumerable spps = from SoilGeometryProbability spp in soilGeometryProbabilities where !spp.SegmentFailureMechanismType.HasValue || !segmentFailureMechanismType.HasValue || spp.SegmentFailureMechanismType == segmentFailureMechanismType orderby spp.Probability descending select spp; if (spps.Any()) + { return spps.First(); - else - return null; + } + + return null; } /// @@ -114,14 +112,14 @@ /// public override string ToString() { - StringBuilder sb = new StringBuilder(); - sb.Append(this.Name); + var sb = new StringBuilder(); + sb.Append(Name); sb.Append(": "); foreach (SegmentFailureMechanismType type in Enum.GetValues(typeof(SegmentFailureMechanismType))) { sb.Append(type.ToString()); sb.Append(": "); - foreach (SoilGeometryProbability spp in this.SoilProfileProbabilities.Where(x => x.SegmentFailureMechanismType == null || x.SegmentFailureMechanismType == type)) + foreach (SoilGeometryProbability spp in SoilProfileProbabilities.Where(x => x.SegmentFailureMechanismType == null || x.SegmentFailureMechanismType == type)) { if (spp.SoilProfile1D != null) { @@ -134,7 +132,8 @@ //#Bka: should be adapted for WtiStability where 2D profiles are used. } } + return sb.ToString(); } } -} +} \ No newline at end of file