Index: Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/GeneralResult.cs
===================================================================
diff -u -ra4bd5433cf68976014c17b17cd9cfb766b135c74 -r2be62a16f4a6d90a76ebb53967a7b7ea3a445cd1
--- Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/GeneralResult.cs (.../GeneralResult.cs) (revision a4bd5433cf68976014c17b17cd9cfb766b135c74)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/GeneralResult.cs (.../GeneralResult.cs) (revision 2be62a16f4a6d90a76ebb53967a7b7ea3a445cd1)
@@ -45,7 +45,7 @@
/// Thrown when any of the input
/// parameters is null.
/// Thrown when one of the input parameters
- /// is invalid (duplicate items, missing items)
+ /// is invalid (duplicate items, missing items).
public GeneralResult(WindDirection governingWindDirection,
IEnumerable stochasts,
IEnumerable topLevelIllustrationPoints)
@@ -63,11 +63,7 @@
throw new ArgumentNullException(nameof(topLevelIllustrationPoints));
}
- IEnumerable points = topLevelIllustrationPoints.OfType();
- if (points.Any())
- {
- ValidateStochastInChildren(points, stochasts);
- }
+ ValidateStochastInChildren(topLevelIllustrationPoints, stochasts);
ValidateStochasts(stochasts);
ValidateTopLevelIllustrationPoints(topLevelIllustrationPoints);
@@ -102,14 +98,26 @@
return clone;
}
- private void ValidateStochastInChildren(IEnumerable topLevelFaultTreeIllustrationPoints, IEnumerable stochasts)
+ private void ValidateStochastInChildren(IEnumerable topLevelillustrationPoints, IEnumerable stochasts)
{
var childStochastNames = new List();
- foreach (TopLevelFaultTreeIllustrationPoint topLevelFaultTreeIllustrationPoint in topLevelFaultTreeIllustrationPoints)
+ foreach (T topLevelIllustrationPoint in topLevelillustrationPoints)
{
- IllustrationPointNode nodeRoot = topLevelFaultTreeIllustrationPoint.FaultTreeNodeRoot;
- childStochastNames.AddRange(GetStochastNamesFromChildren(nodeRoot));
+ var topLevelFaultTreeIllustrationPoint = topLevelIllustrationPoint as TopLevelFaultTreeIllustrationPoint;
+ if (topLevelFaultTreeIllustrationPoint != null)
+ {
+ IllustrationPointNode nodeRoot = topLevelFaultTreeIllustrationPoint.FaultTreeNodeRoot;
+ childStochastNames.AddRange(GetStochastNamesFromChildren(nodeRoot));
+ continue;
+ }
+
+ var topLevelSubMechanismIllustrationPoint = topLevelIllustrationPoint as TopLevelSubMechanismIllustrationPoint;
+ if (topLevelSubMechanismIllustrationPoint != null)
+ {
+ SubMechanismIllustrationPoint nodeRoot = topLevelSubMechanismIllustrationPoint.SubMechanismIllustrationPoint;
+ childStochastNames.AddRange(nodeRoot.Stochasts.Select(s => s.Name));
+ }
}
childStochastNames = childStochastNames.Distinct().ToList();
IEnumerable topLevelStochastNames = stochasts.Select(s => s.Name);