/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.SpecificVolume"/> object. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same SpecificVolume as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.SpecificVolume"/> object to compare with this instance.</param> public bool Equals(SpecificVolume other) { return(this.cubicMetresPerKilogram.Equals(other.cubicMetresPerKilogram)); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.SpecificVolume"/> object within the given tolerance. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same SpecificVolume as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.SpecificVolume"/> object to compare with this instance.</param> /// <param name="tolerance">The maximum difference for being considered equal. Must be greater than zero.</param> public bool Equals(SpecificVolume other, SpecificVolume tolerance) { Ensure.GreaterThan(tolerance.cubicMetresPerKilogram, 0, nameof(tolerance)); return(Math.Abs(this.cubicMetresPerKilogram - other.cubicMetresPerKilogram) < tolerance.cubicMetresPerKilogram); }
/// <summary> /// Compares this instance to a specified <see cref="Gu.Units.SpecificVolume"/> object and returns an integer that indicates whether this <paramref name="quantity"/> is smaller than, equal to, or greater than the <see cref="Gu.Units.SpecificVolume"/> object. /// </summary> /// <returns> /// A signed number indicating the relative quantitys of this instance and <paramref name="quantity"/>. /// Value /// Description /// A negative integer /// This instance is smaller than <paramref name="quantity"/>. /// Zero /// This instance is equal to <paramref name="quantity"/>. /// A positive integer /// This instance is larger than <paramref name="quantity"/>. /// </returns> /// <param name="quantity">An instance of <see cref="Gu.Units.SpecificVolume"/> object to compare to this instance.</param> public int CompareTo(SpecificVolume quantity) { return(this.cubicMetresPerKilogram.CompareTo(quantity.cubicMetresPerKilogram)); }
/// <summary> /// Creates an instance of <see cref="Gu.Units.SpecificVolume"/> from its string representation /// </summary> /// <param name="text">The string representation of the <see cref="Gu.Units.SpecificVolume"/></param> /// <param name="styles">Specifies the <see cref="NumberStyles"/> to be used.</param> /// <param name="provider">Specifies the formatProvider to be used.</param> /// <param name="result">The parsed <see cref="SpecificVolume"/></param> /// <returns>True if an instance of <see cref="SpecificVolume"/> could be parsed from <paramref name="text"/></returns> public static bool TryParse(string text, NumberStyles styles, IFormatProvider provider, out SpecificVolume result) { return(QuantityParser.TryParse <SpecificVolumeUnit, SpecificVolume>(text, From, styles, provider, out result)); }
/// <summary> /// Creates an instance of <see cref="Gu.Units.SpecificVolume"/> from its string representation /// </summary> /// <param name="text">The string representation of the <see cref="Gu.Units.SpecificVolume"/></param> /// <param name="styles">Specifies the <see cref="NumberStyles"/> to be used.</param> /// <param name="result">The parsed <see cref="SpecificVolume"/></param> /// <returns>True if an instance of <see cref="SpecificVolume"/> could be parsed from <paramref name="text"/></returns> public static bool TryParse(string text, NumberStyles styles, out SpecificVolume result) { return(QuantityParser.TryParse <SpecificVolumeUnit, SpecificVolume>(text, From, styles, CultureInfo.CurrentCulture, out result)); }
/// <summary> /// Divides <paramref name="left"/> by <paramref name="right"/> /// </summary> /// <param name="left">The left value</param> /// <param name="right">The right value</param> /// <returns>The <see cref="SpecificVolume"/> that is the result from the division.</returns> public static SpecificVolume operator /(Length left, AreaDensity right) { return(SpecificVolume.FromCubicMetresPerKilogram(left.metres / right.kilogramsPerSquareMetre)); }
/// <summary> /// Divides <paramref name="left"/> by <paramref name="right"/> /// </summary> /// <param name="left">The left value</param> /// <param name="right">The right value</param> /// <returns>The <see cref="SpecificVolume"/> that is the result from the division.</returns> public static SpecificVolume operator /(SpecificEnergy left, Pressure right) { return(SpecificVolume.FromCubicMetresPerKilogram(left.joulesPerKilogram / right.pascals)); }