Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanismAssemblyFactory.cs
===================================================================
diff -u -r06800c4b5c53dd8a385a9f15ce44e9c4038a3726 -reb1cfcbabb96dc3e47ad6405ebe046b26a58752e
--- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanismAssemblyFactory.cs (.../HeightStructuresFailureMechanismAssemblyFactory.cs) (revision 06800c4b5c53dd8a385a9f15ce44e9c4038a3726)
+++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanismAssemblyFactory.cs (.../HeightStructuresFailureMechanismAssemblyFactory.cs) (revision eb1cfcbabb96dc3e47ad6405ebe046b26a58752e)
@@ -21,6 +21,7 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using Ringtoets.AssemblyTool.Data;
using Ringtoets.AssemblyTool.KernelWrapper.Calculators;
using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Assembly;
@@ -216,6 +217,38 @@
}
///
+ /// Gets the assembly category group of the given .
+ ///
+ /// The failure mechanism section result to get the assembly category group for.
+ /// The failure mechanism this section belongs to.
+ /// The this section belongs to.
+ /// A .
+ /// Thrown when any parameter is null.
+ /// Thrown when the
+ /// could not be created.
+ public static FailureMechanismSectionAssemblyCategoryGroup GetSectionAssemblyCategoryGroup(HeightStructuresFailureMechanismSectionResult failureMechanismSectionResult,
+ HeightStructuresFailureMechanism failureMechanism,
+ IAssessmentSection assessmentSection)
+ {
+ if (failureMechanismSectionResult == null)
+ {
+ throw new ArgumentNullException(nameof(failureMechanismSectionResult));
+ }
+
+ if (failureMechanism == null)
+ {
+ throw new ArgumentNullException(nameof(failureMechanism));
+ }
+
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+
+ return GetSectionAssembly(failureMechanismSectionResult, failureMechanism, assessmentSection).Group;
+ }
+
+ ///
/// Assembles the failure mechanism assembly.
///
/// The failure mechanism to assemble for.
@@ -245,9 +278,9 @@
IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance;
AssemblyCategoriesInput assemblyCategoriesInput = CreateAssemblyCategoriesInput(failureMechanism, assessmentSection);
- IEnumerable sectionAssemblies = AssembleSections(failureMechanism,
- assessmentSection,
- assemblyCategoriesInput);
+ IEnumerable sectionAssemblies = failureMechanism.SectionResults
+ .Select(sr => GetSectionAssembly(sr, failureMechanism, assessmentSection))
+ .ToArray();
try
{
@@ -263,38 +296,32 @@
}
///
- /// Assembles the combined assembly for all sections in the .
+ /// Gets the assembly of the given .
///
+ /// The failure mechanism section result to get the assembly for.
/// The failure mechanism to assemble for.
/// The the failure mechanism belongs to.
- /// The input parameters used to determine the assembly categories.
/// A collection of all section assembly results.
/// Thrown when a
/// could not be created.
- private static IEnumerable AssembleSections(HeightStructuresFailureMechanism failureMechanism,
- IAssessmentSection assessmentSection,
- AssemblyCategoriesInput assemblyCategoriesInput)
+ private static FailureMechanismSectionAssembly GetSectionAssembly(HeightStructuresFailureMechanismSectionResult failureMechanismSectionResult,
+ HeightStructuresFailureMechanism failureMechanism,
+ IAssessmentSection assessmentSection)
{
- var sectionAssemblies = new List();
-
- foreach (HeightStructuresFailureMechanismSectionResult sectionResult in failureMechanism.SectionResults)
+ FailureMechanismSectionAssembly sectionAssembly;
+ if (failureMechanismSectionResult.UseManualAssemblyProbability)
{
- FailureMechanismSectionAssembly sectionAssembly;
- if (sectionResult.UseManualAssemblyProbability)
- {
- sectionAssembly = AssembleManualAssessment(sectionResult, assemblyCategoriesInput);
- }
- else
- {
- sectionAssembly = AssembleCombinedAssessment(sectionResult,
- failureMechanism,
- assessmentSection);
- }
-
- sectionAssemblies.Add(sectionAssembly);
+ sectionAssembly = AssembleManualAssessment(failureMechanismSectionResult,
+ CreateAssemblyCategoriesInput(failureMechanism, assessmentSection));
}
+ else
+ {
+ sectionAssembly = AssembleCombinedAssessment(failureMechanismSectionResult,
+ failureMechanism,
+ assessmentSection);
+ }
- return sectionAssemblies;
+ return sectionAssembly;
}
///