// 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 Assembly.Kernel.Model; using Ringtoets.AssemblyTool.Data; using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Assembly; using Ringtoets.Common.Primitives; namespace Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly { /// /// Failure mechanism section assembly calculator stub for testing purposes. /// public class FailureMechanismSectionAssemblyCalculatorStub : IFailureMechanismSectionAssemblyCalculator { /// /// Gets or sets the output of the simple assessment calculation. /// public FailureMechanismSectionAssembly SimpleAssessmentAssemblyOutput { get; set; } /// /// Gets the input of the simple assessment calculation. /// public SimpleAssessmentResultType SimpleAssessmentInput { get; private set; } /// /// Gets the input of the simple assessment validity only calculation. /// public SimpleAssessmentValidityOnlyResultType SimpleAssessmentValidityOnlyInput { get; private set; } /// /// Gets or sets the output of the detailed assessment calculation. /// public FailureMechanismSectionAssembly DetailedAssessmentAssemblyOutput { get; set; } /// /// Gets or sets the group output of the detailed assessment calculation. /// public FailureMechanismSectionAssemblyCategoryGroup? DetailedAssessmentAssemblyGroupOutput { get; set; } /// /// Gets the result type of the detailed assessment calculation. /// public DetailedAssessmentResultType DetailedAssessmentResultInput { get; private set; } /// /// Gets the result type of the detailed assessment calculation. /// public DetailedAssessmentProbabilityOnlyResultType DetailedAssessmentProbabilityOnlyResultInput { get; private set; } /// /// Gets the probability input of the detailed assessment calculation. /// public double DetailedAssessmentProbabilityInput { get; private set; } /// /// Gets the assessment section input of the detailed assessment calculation. /// public AssessmentSection DetailedAssessmentAssessmentSectionInput { get; private set; } /// /// Gets the failure mechanism input of the detailed assessment calculation. /// public FailureMechanism DetailedAssessmentFailureMechanismInput { get; private set; } /// /// Gets the 'N' parameter input of the detailed assessment calculation. /// public double DetailedAssessmentNInput { get; private set; } /// /// Gets the detailed assessment result input for cat Iv - IIv. /// public DetailedAssessmentResultType DetailedAssessmentResultForFactorizedSignalingNormInput { get; private set; } /// /// Gets the detailed assessment result input for cat IIv - IIIv. /// public DetailedAssessmentResultType DetailedAssessmentResultForSignalingNormInput { get; private set; } /// /// Gets the detailed assessment result input for cat IIIv - IVv. /// public DetailedAssessmentResultType DetailedAssessmentResultForMechanismSpecificLowerLimitNormInput { get; private set; } /// /// Gets the detailed assessment result input for cat IVv - Vv. /// public DetailedAssessmentResultType DetailedAssessmentResultForLowerLimitNormInput { get; private set; } /// /// Gets the detailed assessment result input for cat Vv - VIv. /// public DetailedAssessmentResultType DetailedAssessmentResultForFactorizedLowerLimitNormInput { get; private set; } /// /// Gets or sets the output of the tailor made assessment calculation. /// public FailureMechanismSectionAssembly TailorMadeAssessmentAssemblyOutput { get; set; } /// /// Gets the result type of the tailor made assessment calculation. /// public TailorMadeAssessmentResultType TailorMadeAssessmentResultInput { get; private set; } /// /// Gets the result type of the tailor made assessment calculation with probability or detailed calculation result. /// public TailorMadeAssessmentProbabilityAndDetailedCalculationResultType TailorMadeAssessmentProbabilityAndDetailedCalculationResultInput { get; private set; } /// /// Gets the result type of the tailor made assessment calculation with a probability calculation. /// public TailorMadeAssessmentProbabilityCalculationResultType TailorMadeAssessmentProbabilityCalculationResultInput { get; private set; } /// /// Gets the probability input of the tailor made assessment calculation. /// public double TailorMadeAssessmentProbabilityInput { get; private set; } /// /// Gets the assessment section input of the tailor made assessment calculation. /// public AssessmentSection TailorMadeAssessmentAssessmentSectionInput { get; private set; } /// /// Gets the failure mechanism input of the tailor made assessment calculation. /// public FailureMechanism TailorMadeAssessmentFailureMechanismInput { get; private set; } /// /// Gets the 'N' parameter input of the tailor made assessment calculation. /// public double TailorMadeAssessmentNInput { get; private set; } /// /// Gets the category group input of the tailor made assessment calculation. /// public FailureMechanismSectionAssemblyCategoryGroup TailorMadeAssessmentGroupInput { get; private set; } /// /// Gets or sets the output of the tailor made assembly calculation. /// public FailureMechanismSectionAssemblyCategoryGroup? TailorMadeAssemblyCategoryOutput { get; set; } /// /// Gets or sets the output of the combined assembly calculation. /// public FailureMechanismSectionAssembly CombinedAssemblyOutput { get; set; } /// /// Gets the simple assembly input of the combined assembly calculation. /// public FailureMechanismSectionAssembly CombinedSimpleAssemblyInput { get; private set; } /// /// Gets the detailed assembly input of the combined assembly calculation. /// public FailureMechanismSectionAssembly CombinedDetailedAssemblyInput { get; private set; } /// /// Gets the tailor made assembly input of the combined assembly calculation. /// public FailureMechanismSectionAssembly CombinedTailorMadeAssemblyInput { get; private set; } /// /// Gets or sets the output of the combined assembly calculation. /// public FailureMechanismSectionAssemblyCategoryGroup? CombinedAssemblyCategoryOutput { get; set; } /// /// Gets the simple assembly input of the combined assembly calculation. /// public FailureMechanismSectionAssemblyCategoryGroup CombinedSimpleAssemblyGroupInput { get; private set; } /// /// Gets the detailed assembly input of the combined assembly calculation. /// public FailureMechanismSectionAssemblyCategoryGroup CombinedDetailedAssemblyGroupInput { get; private set; } /// /// Gets the tailor made assembly input of the combined assembly calculation. /// public FailureMechanismSectionAssemblyCategoryGroup CombinedTailorMadeAssemblyGroupInput { get; private set; } /// /// Sets an indicator whether an exception must be thrown when performing a calculation. /// public bool ThrowExceptionOnCalculate { private get; set; } /// /// Sets an indicator whether an exception must be thrown when performing a combined assembly calculation. /// public bool ThrowExceptionOnCalculateCombinedAssembly { private get; set; } public FailureMechanismSectionAssembly AssembleSimpleAssessment(SimpleAssessmentResultType input) { if (ThrowExceptionOnCalculate) { throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception()); } SimpleAssessmentInput = input; return SimpleAssessmentAssemblyOutput ?? (SimpleAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(0, FailureMechanismSectionAssemblyCategoryGroup.Iv)); } public FailureMechanismSectionAssembly AssembleSimpleAssessment(SimpleAssessmentValidityOnlyResultType input) { if (ThrowExceptionOnCalculate) { throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception()); } SimpleAssessmentValidityOnlyInput = input; return SimpleAssessmentAssemblyOutput ?? (SimpleAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(1, FailureMechanismSectionAssemblyCategoryGroup.VIIv)); } public FailureMechanismSectionAssemblyCategoryGroup AssembleDetailedAssessment(DetailedAssessmentResultType detailedAssessmentResult) { if (ThrowExceptionOnCalculate) { throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception()); } DetailedAssessmentResultInput = detailedAssessmentResult; if (DetailedAssessmentAssemblyGroupOutput == null) { DetailedAssessmentAssemblyGroupOutput = FailureMechanismSectionAssemblyCategoryGroup.IIv; } return DetailedAssessmentAssemblyGroupOutput.Value; } public FailureMechanismSectionAssembly AssembleDetailedAssessment(DetailedAssessmentProbabilityOnlyResultType detailedAssessmentResult, double probability, AssessmentSection assessmentSection, FailureMechanism failureMechanism) { if (ThrowExceptionOnCalculate) { throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception()); } DetailedAssessmentProbabilityOnlyResultInput = detailedAssessmentResult; DetailedAssessmentProbabilityInput = probability; DetailedAssessmentAssessmentSectionInput = assessmentSection; DetailedAssessmentFailureMechanismInput = failureMechanism; return DetailedAssessmentAssemblyOutput ?? (DetailedAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(1, FailureMechanismSectionAssemblyCategoryGroup.VIv)); } public FailureMechanismSectionAssembly AssembleDetailedAssessment(DetailedAssessmentProbabilityOnlyResultType detailedAssessmentResult, double probability, double n, AssessmentSection assessmentSection, FailureMechanism failureMechanism) { if (ThrowExceptionOnCalculate) { throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception()); } DetailedAssessmentProbabilityOnlyResultInput = detailedAssessmentResult; DetailedAssessmentProbabilityInput = probability; DetailedAssessmentAssessmentSectionInput = assessmentSection; DetailedAssessmentFailureMechanismInput = failureMechanism; DetailedAssessmentNInput = n; return DetailedAssessmentAssemblyOutput ?? (DetailedAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(0, FailureMechanismSectionAssemblyCategoryGroup.VIv)); } public FailureMechanismSectionAssemblyCategoryGroup AssembleDetailedAssessment( DetailedAssessmentResultType detailedAssessmentResultForFactorizedSignalingNorm, DetailedAssessmentResultType detailedAssessmentResultForSignalingNorm, DetailedAssessmentResultType detailedAssessmentResultForMechanismSpecificLowerLimitNorm, DetailedAssessmentResultType detailedAssessmentResultForLowerLimitNorm, DetailedAssessmentResultType detailedAssessmentResultForFactorizedLowerLimitNorm) { if (ThrowExceptionOnCalculate) { throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception()); } DetailedAssessmentResultForFactorizedSignalingNormInput = detailedAssessmentResultForFactorizedSignalingNorm; DetailedAssessmentResultForSignalingNormInput = detailedAssessmentResultForSignalingNorm; DetailedAssessmentResultForMechanismSpecificLowerLimitNormInput = detailedAssessmentResultForMechanismSpecificLowerLimitNorm; DetailedAssessmentResultForLowerLimitNormInput = detailedAssessmentResultForLowerLimitNorm; DetailedAssessmentResultForFactorizedLowerLimitNormInput = detailedAssessmentResultForFactorizedLowerLimitNorm; if (DetailedAssessmentAssemblyGroupOutput == null) { DetailedAssessmentAssemblyGroupOutput = FailureMechanismSectionAssemblyCategoryGroup.IIv; } return DetailedAssessmentAssemblyGroupOutput.Value; } public FailureMechanismSectionAssemblyCategoryGroup AssembleTailorMadeAssessment(TailorMadeAssessmentResultType tailorMadeAssessmentResult) { if (ThrowExceptionOnCalculate) { throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception()); } TailorMadeAssessmentResultInput = tailorMadeAssessmentResult; if (TailorMadeAssemblyCategoryOutput == null) { TailorMadeAssemblyCategoryOutput = FailureMechanismSectionAssemblyCategoryGroup.IIv; } return TailorMadeAssemblyCategoryOutput.Value; } public FailureMechanismSectionAssembly AssembleTailorMadeAssessment(TailorMadeAssessmentProbabilityAndDetailedCalculationResultType tailorMadeAssessmentResult, double probability, AssessmentSection assessmentSection, FailureMechanism failureMechanism) { if (ThrowExceptionOnCalculate) { throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception()); } TailorMadeAssessmentProbabilityAndDetailedCalculationResultInput = tailorMadeAssessmentResult; TailorMadeAssessmentProbabilityInput = probability; TailorMadeAssessmentAssessmentSectionInput = assessmentSection; TailorMadeAssessmentFailureMechanismInput = failureMechanism; return TailorMadeAssessmentAssemblyOutput ?? (TailorMadeAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(1, FailureMechanismSectionAssemblyCategoryGroup.VIv)); } public FailureMechanismSectionAssembly AssembleTailorMadeAssessment(TailorMadeAssessmentProbabilityCalculationResultType tailorMadeAssessmentResult, double probability, AssessmentSection assessmentSection, FailureMechanism failureMechanism) { if (ThrowExceptionOnCalculate) { throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception()); } TailorMadeAssessmentProbabilityCalculationResultInput = tailorMadeAssessmentResult; TailorMadeAssessmentProbabilityInput = probability; TailorMadeAssessmentAssessmentSectionInput = assessmentSection; TailorMadeAssessmentFailureMechanismInput = failureMechanism; return TailorMadeAssessmentAssemblyOutput ?? (TailorMadeAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(1, FailureMechanismSectionAssemblyCategoryGroup.VIv)); } public FailureMechanismSectionAssembly AssembleTailorMadeAssessment(TailorMadeAssessmentProbabilityCalculationResultType tailorMadeAssessmentResult, double probability, double n, AssessmentSection assessmentSection, FailureMechanism failureMechanism) { if (ThrowExceptionOnCalculate) { throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception()); } TailorMadeAssessmentProbabilityCalculationResultInput = tailorMadeAssessmentResult; TailorMadeAssessmentProbabilityInput = probability; TailorMadeAssessmentAssessmentSectionInput = assessmentSection; TailorMadeAssessmentFailureMechanismInput = failureMechanism; TailorMadeAssessmentNInput = n; return TailorMadeAssessmentAssemblyOutput ?? (TailorMadeAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(1, FailureMechanismSectionAssemblyCategoryGroup.VIv)); } public FailureMechanismSectionAssemblyCategoryGroup AssembleTailorMadeAssessment(FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssessmentResult) { if (ThrowExceptionOnCalculate) { throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception()); } TailorMadeAssessmentGroupInput = tailorMadeAssessmentResult; if (TailorMadeAssemblyCategoryOutput == null) { TailorMadeAssemblyCategoryOutput = FailureMechanismSectionAssemblyCategoryGroup.Iv; } return TailorMadeAssemblyCategoryOutput.Value; } public FailureMechanismSectionAssembly AssembleCombined(FailureMechanismSectionAssembly simpleAssembly, FailureMechanismSectionAssembly detailedAssembly, FailureMechanismSectionAssembly tailorMadeAssembly) { if (ThrowExceptionOnCalculateCombinedAssembly) { throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception()); } CombinedSimpleAssemblyInput = simpleAssembly; CombinedDetailedAssemblyInput = detailedAssembly; CombinedTailorMadeAssemblyInput = tailorMadeAssembly; return CombinedAssemblyOutput ?? (CombinedAssemblyOutput = tailorMadeAssembly); } public FailureMechanismSectionAssemblyCategoryGroup AssembleCombined(FailureMechanismSectionAssemblyCategoryGroup simpleAssembly, FailureMechanismSectionAssemblyCategoryGroup detailedAssembly, FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssembly) { if (ThrowExceptionOnCalculateCombinedAssembly) { throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception()); } CombinedSimpleAssemblyGroupInput = simpleAssembly; CombinedDetailedAssemblyGroupInput = detailedAssembly; CombinedTailorMadeAssemblyGroupInput = tailorMadeAssembly; if (CombinedAssemblyCategoryOutput == null) { CombinedAssemblyCategoryOutput = tailorMadeAssembly; } return CombinedAssemblyCategoryOutput.Value; } } }