/// <summary> /// Multiplies <paramref name="left"/> with <paramref name="right"/> /// </summary> /// <param name="left">The left value</param> /// <param name="right">The right value</param> /// <returns>The <see cref="Energy"/> that is the result from the multiplication.</returns> public static Energy operator *(Current left, MagneticFlux right) { return(Energy.FromJoules(left.amperes * right.webers)); }
public static Energy operator *(Length left, Force right) { return(Energy.FromJoules(left.metres * right.newtons)); }
public static Energy operator *(SpecificEnergy left, Mass right) { return(Energy.FromJoules(left.joulesPerKilogram * right.kilograms)); }
public static Energy operator *(Mass left, SpecificEnergy right) { return(Energy.FromJoules(left.kilograms * right.joulesPerKilogram)); }
public static Energy operator *(KinematicViscosity left, MassFlow right) { return(Energy.FromJoules(left.squareMetresPerSecond * right.kilogramsPerSecond)); }
public static Energy operator /(Power left, Frequency right) { return(Energy.FromJoules(left.watts / right.hertz)); }
public static Energy operator *(Voltage left, ElectricCharge right) { return(Energy.FromJoules(left.volts * right.coulombs)); }
/// <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="Energy"/> that is the result from the division.</returns> public static Energy operator /(Force left, Wavenumber right) { return(Energy.FromJoules(left.newtons / right.reciprocalMetres)); }
public static Energy operator *(Power left, Time right) { return(Energy.FromJoules(left.watts * right.seconds)); }
/// <summary> /// Multiplies <paramref name="left"/> with <paramref name="right"/> /// </summary> /// <param name="left">The left value</param> /// <param name="right">The right value</param> /// <returns>The <see cref="Energy"/> that is the result from the multiplication.</returns> public static Energy operator *(Momentum left, Speed right) { return(Energy.FromJoules(left.newtonSecond * right.metresPerSecond)); }
public static Energy operator *(Pressure left, Volume right) { return(Energy.FromJoules(left.pascals * right.cubicMetres)); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Energy"/> object within the given tolerance. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same Energy as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.Energy"/> 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(Energy other, Energy tolerance) { Ensure.GreaterThan(tolerance.joules, 0, nameof(tolerance)); return(Math.Abs(this.joules - other.joules) < tolerance.joules); }
/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Energy"/> object. /// </summary> /// <returns> /// true if <paramref name="other"/> represents the same Energy as this instance; otherwise, false. /// </returns> /// <param name="other">An instance of <see cref="Gu.Units.Energy"/> object to compare with this instance.</param> public bool Equals(Energy other) { return(this.joules.Equals(other.joules)); }
/// <summary> /// Compares this instance to a specified <see cref="Gu.Units.Energy"/> 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.Energy"/> 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.Energy"/> object to compare to this instance.</param> public int CompareTo(Energy quantity) { return(this.joules.CompareTo(quantity.joules)); }
/// <summary> /// Creates an instance of <see cref="Gu.Units.Energy"/> from its string representation /// </summary> /// <param name="text">The string representation of the <see cref="Gu.Units.Energy"/></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="Energy"/></param> /// <returns>True if an instance of <see cref="Energy"/> could be parsed from <paramref name="text"/></returns> public static bool TryParse(string text, NumberStyles styles, IFormatProvider provider, out Energy result) { return(QuantityParser.TryParse <EnergyUnit, Energy>(text, From, styles, provider, out result)); }
/// <summary> /// Creates an instance of <see cref="Gu.Units.Energy"/> from its string representation /// </summary> /// <param name="text">The string representation of the <see cref="Gu.Units.Energy"/></param> /// <param name="styles">Specifies the <see cref="NumberStyles"/> to be used.</param> /// <param name="result">The parsed <see cref="Energy"/></param> /// <returns>True if an instance of <see cref="Energy"/> could be parsed from <paramref name="text"/></returns> public static bool TryParse(string text, NumberStyles styles, out Energy result) { return(QuantityParser.TryParse <EnergyUnit, Energy>(text, From, styles, CultureInfo.CurrentCulture, out result)); }