Index: Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationService.cs
===================================================================
diff -u -rf4f041e353f89e0e93a4243968acee599b2186a7 -rd007879e7471c7426c966cd9999e5c7e37da88dc
--- Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationService.cs (.../WaveHeightCalculationService.cs) (revision f4f041e353f89e0e93a4243968acee599b2186a7)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationService.cs (.../WaveHeightCalculationService.cs) (revision d007879e7471c7426c966cd9999e5c7e37da88dc)
@@ -19,9 +19,11 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using Core.Common.IO.Exceptions;
using Core.Common.Utils;
using log4net;
using Ringtoets.Common.Data.Hydraulics;
@@ -77,6 +79,20 @@
/// The id of the assessment section.
/// The norm of the assessment section.
/// The object which is used to build log messages.
+ /// Thrown when is null.
+ /// Thrown when
+ ///
+ /// - contains invalid characters.
+ /// - The target propability or the calculated propability falls outside the [0.0, 1.0] range and is not .
+ ///
+ /// Thrown when:
+ ///
+ /// - No settings database file could be found at the location of
+ /// with the same name.
+ /// - Unable to open settings database file.
+ /// - Unable to read required data from database file.
+ ///
+ ///
/// Thrown when an error occurs during parsing of the Hydra-Ring output.
/// Thrown when an error occurs during the calculation.
public void Calculate(HydraulicBoundaryLocation hydraulicBoundaryLocation,
@@ -85,6 +101,11 @@
double norm,
ICalculationMessageProvider messageProvider)
{
+ if (hydraulicBoundaryLocation == null)
+ {
+ throw new ArgumentNullException(nameof(hydraulicBoundaryLocation));
+ }
+
string hlcdDirectory = Path.GetDirectoryName(hydraulicBoundaryDatabaseFilePath);
string calculationName = messageProvider.GetCalculationName(hydraulicBoundaryLocation.Name);
@@ -142,13 +163,20 @@
///
public void Cancel()
{
- if (calculator != null)
- {
- calculator.Cancel();
- canceled = true;
- }
+ calculator?.Cancel();
+ canceled = true;
}
+ ///
+ /// Creates the output of the calculation.
+ ///
+ /// The object which is used to build log messages.
+ /// The name of the hydraulic boundary location.
+ /// The target reliability for the calculation.
+ /// The target probability for the calculation.
+ /// A .
+ /// Thrown when
+ /// or the calculated propability falls outside the [0.0, 1.0] range and is not .
private HydraulicBoundaryLocationOutput CreateHydraulicBoundaryLocationOutput(ICalculationMessageProvider messageProvider,
string hydraulicBoundaryLocationName,
double targetReliability,
@@ -171,6 +199,23 @@
converged);
}
+ ///
+ /// Creates the input for an wave height calculation.
+ ///
+ /// The to create the input from.
+ /// The norm to use during the calculation.
+ /// The filepath to the hydraulic boundary database.
+ ///
+ /// Thrown when the
+ /// contains invalid characters.
+ /// Thrown when:
+ ///
+ /// - No settings database file could be found at the location of
+ /// with the same name.
+ /// - Unable to open settings database file.
+ /// - Unable to read required data from database file.
+ ///
+ ///
private static WaveHeightCalculationInput CreateInput(HydraulicBoundaryLocation hydraulicBoundaryLocation,
double norm,
string hydraulicBoundaryDatabaseFilePath)