// Copyright (C) Stichting Deltares 2017. All rights reserved.
//
// This file is part of Ringtoets.
//
// Ringtoets is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
//
// All names, logos, and references to "Deltares" are registered trademarks of
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
using System;
using System.Collections.Generic;
using System.Linq;
using Ringtoets.Common.Data.Hydraulics;
using Ringtoets.Common.Service;
namespace Ringtoets.Common.Forms.Helpers
{
///
/// This class defines factory methods that can be used to create instances of for
/// hydraulic boundary location calculations.
///
public static class HydraulicBoundaryLocationCalculationActivityFactory
{
///
/// Creates a collection of for wave height calculations
/// based on the given parameters.
///
/// The path of the hydraulic boundary database file.
/// The preprocessor directory.
/// The collection of to create
/// the activities for.
/// The norm to use during the calculations.
/// The category boundary name for the calculations.
/// A collection of .
/// Thrown when is null.
/// Thrown when is null or empty.
public static IEnumerable CreateWaveHeightCalculationActivities(
string hydraulicBoundaryDatabaseFilePath,
string preprocessorDirectory,
IEnumerable calculations,
double norm,
string categoryBoundaryName)
{
if (calculations == null)
{
throw new ArgumentNullException(nameof(calculations));
}
if (categoryBoundaryName == null)
{
throw new ArgumentNullException(nameof(categoryBoundaryName));
}
return calculations.Select(calculation => new WaveHeightCalculationActivity(calculation,
hydraulicBoundaryDatabaseFilePath,
preprocessorDirectory,
norm,
categoryBoundaryName)).ToArray();
}
///
/// Creates a collection of for design water level calculations
/// based on the given parameters.
///
/// The path of the hydraulic boundary database file.
/// The preprocessor directory.
/// The collection of to create
/// the activities for.
/// The norm to use during the calculations.
/// The category boundary name to use for the activities.
/// A collection of .
/// Thrown when is null.
/// Thrown when is null or empty.
public static IEnumerable CreateDesignWaterLevelCalculationActivities(
string hydraulicBoundaryDatabaseFilePath,
string preprocessorDirectory,
IEnumerable calculations,
double norm,
string categoryBoundaryName)
{
if (calculations == null)
{
throw new ArgumentNullException(nameof(calculations));
}
return calculations.Select(calculation => new DesignWaterLevelCalculationActivity(calculation,
hydraulicBoundaryDatabaseFilePath,
preprocessorDirectory,
norm,
categoryBoundaryName)).ToArray();
}
}
}