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); }
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)); }
/// <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)); }
/// <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)); }
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; }
/// <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); }
/// <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); }