// 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 Ringtoets.MacroStabilityInwards.Primitives.Properties;
namespace Ringtoets.MacroStabilityInwards.Primitives
{
///
/// This class represents a preconsolidation stress definition that was imported
/// from D-Soil model.
///
public class MacroStabilityInwardsPreconsolidationStress
{
///
/// Creates a new instance of .
///
/// The x coordinate of the preconsolidation stress location.
/// The z coordinate of the preconsolidation stress location.
/// The mean of the stochastic distribution
/// for the preconsolidation stress.
/// The coefficient of
/// variation of the stochastic distribution for the preconsolidation stress.
/// The shift of the stochastic distribution
/// for the preconsolidation stress
/// Thrown when any of the parameters has an invalid value.
public MacroStabilityInwardsPreconsolidationStress(double xCoordinate,
double zCoordinate,
double preconsolidationStressMean,
double preconsolidationStressCoefficientOfVariation,
double preconsolidationStressShift)
{
ValidateParameter(xCoordinate, Resources.MacroStabilityInwardsPreconsolidationStress_XCoordinate_ParameterName);
ValidateParameter(zCoordinate, Resources.MacroStabilityInwardsPreconsolidationStress_ZCoordinate_ParameterName);
ValidateParameter(preconsolidationStressMean, Resources.MacroStabilityInwardsPreconsolidationStress_PreconsolidationStressMean_ParameterName);
ValidateParameter(preconsolidationStressCoefficientOfVariation, Resources.MacroStabilityInwardsPreconsolidationStress_PreconsolidationStressCoefficientOfVariation_ParameterName);
ValidateParameter(preconsolidationStressShift, Resources.MacroStabilityInwardsPreconsolidationStress_PreconsolidationStressShift_ParameterName);
XCoordinate = xCoordinate;
ZCoordinate = zCoordinate;
PreconsolidationStressMean = preconsolidationStressMean;
PreconsolidationStressCoefficientOfVariation = preconsolidationStressCoefficientOfVariation;
PreconsolidationStressShift = preconsolidationStressShift;
}
///
/// Gets the value representing the X coordinate of the preconsolidation stress location.
/// [m]
///
public double XCoordinate { get; }
///
/// Gets the value representing the Z coordinate of the preconsolidation stress location.
/// [m]
///
public double ZCoordinate { get; }
///
/// Gets the value representing the mean of the distribution for the preconsolidation stress.
/// [kN/m³]
///
public double PreconsolidationStressMean { get; }
///
/// Gets the value representing the coefficient of variation of the distribution for the preconsolidation stress.
/// [kN/m³]
///
public double PreconsolidationStressCoefficientOfVariation { get; }
///
/// Gets the value representing the shift of the distribution for the preconsolidation stress.
/// [kN/m³]
///
public double PreconsolidationStressShift { get; }
///
/// Validates if the is a valid value.
///
/// The value to validate.
/// The name of the parameter to validate.
/// Thrown if the parameter value is invalid.
private static void ValidateParameter(double value, string parameterName)
{
if (double.IsNaN(value))
{
string message = string.Format(Resources.MacroStabilityInwardsPreconsolidationStress_ValidateParameter_The_value_of_ParameterName_0_must_be_a_concrete_value, parameterName);
throw new ArgumentException(message);
}
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
if (ReferenceEquals(this, obj))
{
return true;
}
if (obj.GetType() != GetType())
{
return false;
}
return Equals((MacroStabilityInwardsPreconsolidationStress) obj);
}
private bool Equals(MacroStabilityInwardsPreconsolidationStress other)
{
return XCoordinate.Equals(other.XCoordinate)
&& ZCoordinate.Equals(other.ZCoordinate)
&& PreconsolidationStressMean.Equals(other.PreconsolidationStressMean)
&& PreconsolidationStressCoefficientOfVariation.Equals(other.PreconsolidationStressCoefficientOfVariation)
&& PreconsolidationStressShift.Equals(other.PreconsolidationStressShift);
}
public override int GetHashCode()
{
unchecked
{
int hashCode = XCoordinate.GetHashCode();
hashCode = (hashCode * 397) ^ ZCoordinate.GetHashCode();
hashCode = (hashCode * 397) ^ PreconsolidationStressMean.GetHashCode();
hashCode = (hashCode * 397) ^ PreconsolidationStressCoefficientOfVariation.GetHashCode();
hashCode = (hashCode * 397) ^ PreconsolidationStressShift.GetHashCode();
return hashCode;
}
}
}
}