コード例 #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);
 }
コード例 #2
0
 private static void AssertMatchingQuantityDimensions <Q>(QuantityDimension iActualDimension) where Q : struct, IQuantity <Q>
 {
     if (default(Q).Dimension.Equals(iActualDimension))
     {
         return;
     }
     throw new InvalidOperationException(
               String.Format("Actual quantity dimension: {0}, expected {1} for quantity {2}",
                             iActualDimension, default(Q).Dimension, default(Q).GetType().Name));
 }
コード例 #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(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(AreExponentsEqualTo(other));
 }
コード例 #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(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Math.Abs(other.DimensionlessDifferentiator - DimensionlessDifferentiator) < EPSILON &&
            AreExponentsEqualTo(other));
 }
コード例 #5
0
ファイル: QuantityDimension.cs プロジェクト: bjaminn/csunits
 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;
 }
コード例 #6
0
ファイル: QuantityDimension.cs プロジェクト: bjaminn/csunits
 /// <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(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return AreExponentsEqualTo(other);
 }
コード例 #7
0
ファイル: QuantityDimension.cs プロジェクト: bjaminn/csunits
 /// <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(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return Math.Abs(other.DimensionlessDifferentiator - DimensionlessDifferentiator) < EPSILON &&
            AreExponentsEqualTo(other);
 }