/// <summary>
        /// Reads an instance of <see cref="Gu.Units.Wavenumber"/> from the <paramref name="reader"/>
        /// </summary>
        /// <param name="reader"></param>
        /// <returns>An instance of  <see cref="Gu.Units.Wavenumber"/></returns>
        public static Wavenumber ReadFrom(XmlReader reader)
        {
            var v = new Wavenumber();

            v.ReadXml(reader);
            return(v);
        }
Beispiel #2
0
        /// <devdoc>
        /// <para>Converts the given object to a <see cref='Gu.Units.Wavenumber'/>
        /// object.</para>
        /// </devdoc>
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            var text = value as string;

            if (text != null)
            {
                return(Wavenumber.Parse(text, culture));
            }

            return(base.ConvertFrom(context, culture, value));
        }
Beispiel #3
0
        public void ReadXml(XmlReader reader)
        {
            reader.MoveToContent();
            var attribute = reader.GetAttribute("Value");

            if (attribute is null)
            {
                throw new XmlException($"Could not find attribute named: Value");
            }

            this = new Wavenumber(XmlConvert.ToDouble(attribute), WavenumberUnit.ReciprocalMetres);
            reader.ReadStartElement();
        }
 /// <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="Wavenumber"/> that is the result from the multiplication.</returns>
 public static Wavenumber operator *(Flexibility left, Pressure right)
 {
     return(Wavenumber.FromReciprocalMetres(left.metresPerNewton * right.pascals));
 }
 public static Wavenumber operator /(Frequency left, Speed right)
 {
     return(Wavenumber.FromReciprocalMetres(left.hertz / right.metresPerSecond));
 }
Beispiel #6
0
 public static Wavenumber operator /(Area left, Volume right)
 {
     return(Wavenumber.FromReciprocalMetres(left.squareMetres / right.cubicMetres));
 }
Beispiel #7
0
 public static Wavenumber operator /(Force left, Energy right)
 {
     return(Wavenumber.FromReciprocalMetres(left.newtons / right.joules));
 }
Beispiel #8
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="Wavenumber"/> that is the result from the division.</returns>
 public static Wavenumber operator /(Pressure left, Stiffness right)
 {
     return(Wavenumber.FromReciprocalMetres(left.pascals / right.newtonsPerMetre));
 }
 /// <summary>
 /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Wavenumber"/> object within the given tolerance.
 /// </summary>
 /// <returns>
 /// true if <paramref name="other"/> represents the same Wavenumber as this instance; otherwise, false.
 /// </returns>
 /// <param name="other">An instance of <see cref="Gu.Units.Wavenumber"/> 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(Wavenumber other, Wavenumber tolerance)
 {
     Ensure.GreaterThan(tolerance.reciprocalMetres, 0, nameof(tolerance));
     return(Math.Abs(this.reciprocalMetres - other.reciprocalMetres) < tolerance.reciprocalMetres);
 }
Beispiel #10
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 Wavenumber that is the result from the division.</returns>
 public static Wavenumber operator /(double left, Length right)
 {
     return(Wavenumber.FromReciprocalMetres(left / right.metres));
 }
Beispiel #11
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="Wavenumber"/> that is the result from the division.</returns>
 public static Wavenumber operator /(Density left, AreaDensity right)
 {
     return(Wavenumber.FromReciprocalMetres(left.kilogramsPerCubicMetre / right.kilogramsPerSquareMetre));
 }
Beispiel #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="Wavenumber"/> that is the result from the division.</returns>
 public static Wavenumber operator /(Length left, Area right)
 {
     return(Wavenumber.FromReciprocalMetres(left.metres / right.squareMetres));
 }
 /// <summary>
 /// Creates an instance of <see cref="Gu.Units.Wavenumber"/> from its string representation
 /// </summary>
 /// <param name="text">The string representation of the <see cref="Gu.Units.Wavenumber"/></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="Wavenumber"/></param>
 /// <returns>True if an instance of <see cref="Wavenumber"/> could be parsed from <paramref name="text"/></returns>
 public static bool TryParse(string text, NumberStyles styles, IFormatProvider provider, out Wavenumber result)
 {
     return(QuantityParser.TryParse <WavenumberUnit, Wavenumber>(text, From, styles, provider, out result));
 }
Beispiel #14
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="Wavenumber"/> that is the result from the division.</returns>
 public static Wavenumber operator /(Speed left, KinematicViscosity right)
 {
     return(Wavenumber.FromReciprocalMetres(left.metresPerSecond / right.squareMetresPerSecond));
 }
 /// <summary>
 /// Creates an instance of <see cref="Gu.Units.Wavenumber"/> from its string representation
 /// </summary>
 /// <param name="text">The string representation of the <see cref="Gu.Units.Wavenumber"/></param>
 /// <param name="styles">Specifies the <see cref="NumberStyles"/> to be used.</param>
 /// <param name="result">The parsed <see cref="Wavenumber"/></param>
 /// <returns>True if an instance of <see cref="Wavenumber"/> could be parsed from <paramref name="text"/></returns>
 public static bool TryParse(string text, NumberStyles styles, out Wavenumber result)
 {
     return(QuantityParser.TryParse <WavenumberUnit, Wavenumber>(text, From, styles, CultureInfo.CurrentCulture, out result));
 }
Beispiel #16
0
 public static Wavenumber operator /(Acceleration left, SpecificEnergy right)
 {
     return(Wavenumber.FromReciprocalMetres(left.metresPerSecondSquared / right.joulesPerKilogram));
 }
Beispiel #17
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="Wavenumber"/> that is the result from the division.</returns>
 public static Wavenumber operator /(Stiffness left, Force right)
 {
     return(Wavenumber.FromReciprocalMetres(left.newtonsPerMetre / right.newtons));
 }
 public static Wavenumber operator *(Resistance left, Conductivity right)
 {
     return(Wavenumber.FromReciprocalMetres(left.ohms * right.siemensPerMetre));
 }
 /// <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="Wavenumber"/> that is the result from the division.</returns>
 public static Wavenumber operator /(Conductivity left, ElectricalConductance right)
 {
     return(Wavenumber.FromReciprocalMetres(left.siemensPerMetre / right.siemens));
 }
Beispiel #20
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="Wavenumber"/> that is the result from the division.</returns>
 public static Wavenumber operator /(MassFlow left, Momentum right)
 {
     return(Wavenumber.FromReciprocalMetres(left.kilogramsPerSecond / right.newtonSecond));
 }
 /// <summary>
 /// Compares this instance to a specified <see cref="Gu.Units.Wavenumber"/> 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.Wavenumber"/> 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.Wavenumber"/> object to compare to this instance.</param>
 public int CompareTo(Wavenumber quantity)
 {
     return(this.reciprocalMetres.CompareTo(quantity.reciprocalMetres));
 }
 /// <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="Wavenumber"/> that is the result from the division.</returns>
 public static Wavenumber operator /(KinematicViscosity left, VolumetricFlow right)
 {
     return(Wavenumber.FromReciprocalMetres(left.squareMetresPerSecond / right.cubicMetresPerSecond));
 }
 /// <summary>
 /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Wavenumber"/> object.
 /// </summary>
 /// <returns>
 /// true if <paramref name="other"/> represents the same Wavenumber as this instance; otherwise, false.
 /// </returns>
 /// <param name="other">An instance of <see cref="Gu.Units.Wavenumber"/> object to compare with this instance.</param>
 public bool Equals(Wavenumber other)
 {
     return(this.reciprocalMetres.Equals(other.reciprocalMetres));
 }