Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Helpers/FailureMechanismSectionPresentationHelper.cs =================================================================== diff -u -r4b48a3e7866946bb18c5bfe15b04bd51183fd335 -rec3f583fecca7609a3a9266a88950f25f277c5dc --- Ringtoets/Common/src/Ringtoets.Common.Forms/Helpers/FailureMechanismSectionPresentationHelper.cs (.../FailureMechanismSectionPresentationHelper.cs) (revision 4b48a3e7866946bb18c5bfe15b04bd51183fd335) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Helpers/FailureMechanismSectionPresentationHelper.cs (.../FailureMechanismSectionPresentationHelper.cs) (revision ec3f583fecca7609a3a9266a88950f25f277c5dc) @@ -38,25 +38,25 @@ /// The type of the presentation objects. /// The failure mechanism sections to create presentation /// objects for. - /// + /// /// for creating the presentation objects of type , in which: /// - /// - T1 represents the failure mechanism section at stake; - /// - T2 represents the start of the section in relation to the beginning of the reference line; - /// - T3 represents the end of the section in relation to the beginning of the reference line. + /// T1 represents the failure mechanism section at stake; + /// T2 represents the start of the section in relation to the beginning of the reference line; + /// T3 represents the end of the section in relation to the beginning of the reference line. /// /// /// The created presentation objects. public static IEnumerable CreatePresentableFailureMechanismSections(IEnumerable failureMechanismSections, - Func createPresentableFailureMechanismSection) + Func createPresentableFailureMechanismSectionFunc) { double start = 0; foreach (FailureMechanismSection failureMechanismSection in failureMechanismSections) { double end = start + failureMechanismSection.Length; - yield return createPresentableFailureMechanismSection(failureMechanismSection, start, end); + yield return createPresentableFailureMechanismSectionFunc(failureMechanismSection, start, end); start = end; } Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismSectionsProbabilityAssessmentProperties.cs =================================================================== diff -u -rd17cff71645c0e605aaf84268caaad7c3d886da2 -rec3f583fecca7609a3a9266a88950f25f277c5dc --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismSectionsProbabilityAssessmentProperties.cs (.../FailureMechanismSectionsProbabilityAssessmentProperties.cs) (revision d17cff71645c0e605aaf84268caaad7c3d886da2) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismSectionsProbabilityAssessmentProperties.cs (.../FailureMechanismSectionsProbabilityAssessmentProperties.cs) (revision ec3f583fecca7609a3a9266a88950f25f277c5dc) @@ -20,7 +20,6 @@ // All rights reserved. using System; -using System.Collections.Generic; using System.ComponentModel; using System.Linq; using Core.Common.Base; @@ -30,6 +29,7 @@ using Core.Common.Util.Attributes; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Probability; +using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.Forms.Properties; namespace Ringtoets.Common.Forms.PropertyClasses @@ -93,17 +93,10 @@ { get { - var properties = new List(); - double sectionStart = 0; - foreach (FailureMechanismSection section in data.Sections) - { - double sectionEnd = sectionStart + section.Length; - properties.Add(new FailureMechanismSectionProbabilityAssessmentProperties(section, sectionStart, sectionEnd, - probabilityAssessmentInput)); - sectionStart = sectionEnd; - } - - return properties.ToArray(); + return FailureMechanismSectionPresentationHelper.CreatePresentableFailureMechanismSections( + data.Sections, + CreateFailureMechanismSectionProbabilityAssessmentProperties) + .ToArray(); } } @@ -120,5 +113,12 @@ failureMechanismObserver.Dispose(); } } + + private FailureMechanismSectionProbabilityAssessmentProperties CreateFailureMechanismSectionProbabilityAssessmentProperties(FailureMechanismSection section, + double sectionStart, + double sectionEnd) + { + return new FailureMechanismSectionProbabilityAssessmentProperties(section, sectionStart, sectionEnd, probabilityAssessmentInput); + } } } \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismSectionsProperties.cs =================================================================== diff -u -rd17cff71645c0e605aaf84268caaad7c3d886da2 -rec3f583fecca7609a3a9266a88950f25f277c5dc --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismSectionsProperties.cs (.../FailureMechanismSectionsProperties.cs) (revision d17cff71645c0e605aaf84268caaad7c3d886da2) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismSectionsProperties.cs (.../FailureMechanismSectionsProperties.cs) (revision ec3f583fecca7609a3a9266a88950f25f277c5dc) @@ -20,7 +20,6 @@ // All rights reserved. using System; -using System.Collections.Generic; using System.ComponentModel; using System.Linq; using Core.Common.Base; @@ -29,6 +28,7 @@ using Core.Common.Gui.PropertyBag; using Core.Common.Util.Attributes; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.Forms.Properties; namespace Ringtoets.Common.Forms.PropertyClasses @@ -82,16 +82,10 @@ { get { - var properties = new List(); - double sectionStart = 0; - foreach (FailureMechanismSection section in data.Sections) - { - double sectionEnd = sectionStart + section.Length; - properties.Add(new FailureMechanismSectionProperties(section, sectionStart, sectionEnd)); - sectionStart = sectionEnd; - } - - return properties.ToArray(); + return FailureMechanismSectionPresentationHelper.CreatePresentableFailureMechanismSections( + data.Sections, + CreateFailureMechanismSectionProperties) + .ToArray(); } } @@ -108,5 +102,12 @@ failureMechanismObserver.Dispose(); } } + + private static FailureMechanismSectionProperties CreateFailureMechanismSectionProperties(FailureMechanismSection section, + double sectionStart, + double sectionEnd) + { + return new FailureMechanismSectionProperties(section, sectionStart, sectionEnd); + } } } \ No newline at end of file