Esempio n. 1
0
 private bool AreExponentsEqualTo(QuantityDimension other)
 {
     return(other.LengthExponent == LengthExponent && other.MassExponent == MassExponent &&
            other.TimeExponent == TimeExponent &&
            other.ElectricCurrentExponent == ElectricCurrentExponent &&
            other.TemperatureExponent == TemperatureExponent &&
            other.LuminousIntensityExponent == LuminousIntensityExponent &&
            other.AmountOfSubstanceExponent == AmountOfSubstanceExponent);
 }
Esempio n. 2
0
 private static void AssertMatchingQuantityDimensions <Q>(QuantityDimension iActualDimension)
     where Q : class, IQuantity <Q>, new()
 {
     if (new Q().Dimension.Equals(iActualDimension))
     {
         return;
     }
     throw new InvalidOperationException(
               $"Actual quantity dimension: {iActualDimension}, expected {new Q().Dimension} for quantity {new Q().GetType().Name}");
 }
Esempio n. 3
0
 /// <summary>
 /// Compare the exponents of this object with another quantity dimension object for dimensional equality
 /// </summary>
 /// <param name="other">Quantity dimension object with which to compare dimensional equality</param>
 /// <returns>true if all exponent elements of this and the other object are equal, false otherwise</returns>
 internal bool ExponentsEqual(QuantityDimension other)
 {
     if (ReferenceEquals(objA: null, objB: other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(AreExponentsEqualTo(other));
 }
Esempio n. 4
0
 /// <summary>
 /// Compare this object with another quantity dimension object for equality
 /// </summary>
 /// <param name="other">Quantity dimension object with which to compare equality</param>
 /// <returns>true if all elements of this and the other object are equal, false otherwise</returns>
 internal bool Equals(QuantityDimension other)
 {
     if (ReferenceEquals(objA: null, objB: other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Math.Abs(other.DimensionlessDifferentiator - DimensionlessDifferentiator) < EPSILON &&
            AreExponentsEqualTo(other));
 }