Exemple #1
0
 public static Force operator *(Mass left, Acceleration right)
 {
     return(Force.FromNewtons(left.kilograms * right.metresPerSecondSquared));
 }
 public static Force operator *(ForcePerUnitless left, Unitless right)
 {
     return(Force.FromNewtons(left.newtonsPerUnitless * right.scalar));
 }
 public static Force operator /(Power left, Speed right)
 {
     return(Force.FromNewtons(left.watts / right.metresPerSecond));
 }
Exemple #4
0
 /// <summary>
 /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Force"/> object.
 /// </summary>
 /// <returns>
 /// true if <paramref name="other"/> represents the same Force as this instance; otherwise, false.
 /// </returns>
 /// <param name="other">An instance of <see cref="Gu.Units.Force"/> object to compare with this instance.</param>
 public bool Equals(Force other)
 {
     return(this.newtons.Equals(other.newtons));
 }
Exemple #5
0
 /// <summary>
 /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Force"/> object within the given tolerance.
 /// </summary>
 /// <returns>
 /// true if <paramref name="other"/> represents the same Force as this instance; otherwise, false.
 /// </returns>
 /// <param name="other">An instance of <see cref="Gu.Units.Force"/> 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(Force other, Force tolerance)
 {
     Ensure.GreaterThan(tolerance.newtons, 0, nameof(tolerance));
     return(Math.Abs(this.newtons - other.newtons) < tolerance.newtons);
 }
Exemple #6
0
 /// <summary>
 /// Creates an instance of <see cref="Gu.Units.Force"/> from its string representation
 /// </summary>
 /// <param name="text">The string representation of the <see cref="Gu.Units.Force"/></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="Force"/></param>
 /// <returns>True if an instance of <see cref="Force"/> could be parsed from <paramref name="text"/></returns>
 public static bool TryParse(string text, NumberStyles styles, IFormatProvider provider, out Force result)
 {
     return(QuantityParser.TryParse <ForceUnit, Force>(text, From, styles, provider, out result));
 }
Exemple #7
0
 /// <summary>
 /// Compares this instance to a specified <see cref="Gu.Units.Force"/> 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.Force"/> 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.Force"/> object to compare to this instance.</param>
 public int CompareTo(Force quantity)
 {
     return(this.newtons.CompareTo(quantity.newtons));
 }
Exemple #8
0
 public static Force operator /(Energy left, Length right)
 {
     return(Force.FromNewtons(left.joules / right.metres));
 }
Exemple #9
0
 /// <summary>
 /// Creates an instance of <see cref="Gu.Units.Force"/> from its string representation
 /// </summary>
 /// <param name="text">The string representation of the <see cref="Gu.Units.Force"/></param>
 /// <param name="styles">Specifies the <see cref="NumberStyles"/> to be used.</param>
 /// <param name="result">The parsed <see cref="Force"/></param>
 /// <returns>True if an instance of <see cref="Force"/> could be parsed from <paramref name="text"/></returns>
 public static bool TryParse(string text, NumberStyles styles, out Force result)
 {
     return(QuantityParser.TryParse <ForceUnit, Force>(text, From, styles, CultureInfo.CurrentCulture, out result));
 }
 public static Force operator *(Pressure left, Area right)
 {
     return(Force.FromNewtons(left.pascals * right.squareMetres));
 }
Exemple #11
0
 public static Force operator *(double left, ForceUnit right)
 {
     return(Force.From(left, right));
 }
Exemple #12
0
 /// <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="Force"/> that is the result from the division.</returns>
 public static Force operator /(Momentum left, Time right)
 {
     return(Force.FromNewtons(left.newtonSecond / right.seconds));
 }
Exemple #13
0
 /// <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="Force"/> that is the result from the multiplication.</returns>
 public static Force operator *(Momentum left, Frequency right)
 {
     return(Force.FromNewtons(left.newtonSecond * right.hertz));
 }
Exemple #14
0
 /// <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="Force"/> that is the result from the multiplication.</returns>
 public static Force operator *(Energy left, Wavenumber right)
 {
     return(Force.FromNewtons(left.joules * right.reciprocalMetres));
 }