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

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

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

            return(base.ConvertFrom(context, culture, value));
        }
        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 Flexibility(XmlConvert.ToDouble(attribute), FlexibilityUnit.MetresPerNewton);
            reader.ReadStartElement();
        }
 /// <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="Flexibility"/> that is the result from the division.</returns>
 public static Flexibility operator /(KinematicViscosity left, Power right)
 {
     return(Flexibility.FromMetresPerNewton(left.squareMetresPerSecond / right.watts));
 }
Example #5
0
 public static Flexibility operator *(double left, FlexibilityUnit right)
 {
     return(Flexibility.From(left, right));
 }
 /// <summary>
 /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Flexibility"/> object within the given tolerance.
 /// </summary>
 /// <returns>
 /// true if <paramref name="other"/> represents the same Flexibility as this instance; otherwise, false.
 /// </returns>
 /// <param name="other">An instance of <see cref="Gu.Units.Flexibility"/> 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(Flexibility other, Flexibility tolerance)
 {
     Ensure.GreaterThan(tolerance.metresPerNewton, 0, nameof(tolerance));
     return(Math.Abs(this.metresPerNewton - other.metresPerNewton) < tolerance.metresPerNewton);
 }
 /// <summary>
 /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Flexibility"/> object.
 /// </summary>
 /// <returns>
 /// true if <paramref name="other"/> represents the same Flexibility as this instance; otherwise, false.
 /// </returns>
 /// <param name="other">An instance of <see cref="Gu.Units.Flexibility"/> object to compare with this instance.</param>
 public bool Equals(Flexibility other)
 {
     return(this.metresPerNewton.Equals(other.metresPerNewton));
 }
 /// <summary>
 /// Compares this instance to a specified <see cref="Gu.Units.Flexibility"/> 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.Flexibility"/> 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.Flexibility"/> object to compare to this instance.</param>
 public int CompareTo(Flexibility quantity)
 {
     return(this.metresPerNewton.CompareTo(quantity.metresPerNewton));
 }
 /// <summary>
 /// Creates an instance of <see cref="Gu.Units.Flexibility"/> from its string representation
 /// </summary>
 /// <param name="text">The string representation of the <see cref="Gu.Units.Flexibility"/></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="Flexibility"/></param>
 /// <returns>True if an instance of <see cref="Flexibility"/> could be parsed from <paramref name="text"/></returns>
 public static bool TryParse(string text, NumberStyles styles, IFormatProvider provider, out Flexibility result)
 {
     return(QuantityParser.TryParse <FlexibilityUnit, Flexibility>(text, From, styles, provider, out result));
 }
Example #10
0
 /// <summary>
 /// Creates an instance of <see cref="Gu.Units.Flexibility"/> from its string representation
 /// </summary>
 /// <param name="text">The string representation of the <see cref="Gu.Units.Flexibility"/></param>
 /// <param name="styles">Specifies the <see cref="NumberStyles"/> to be used.</param>
 /// <param name="result">The parsed <see cref="Flexibility"/></param>
 /// <returns>True if an instance of <see cref="Flexibility"/> could be parsed from <paramref name="text"/></returns>
 public static bool TryParse(string text, NumberStyles styles, out Flexibility result)
 {
     return(QuantityParser.TryParse <FlexibilityUnit, Flexibility>(text, From, styles, CultureInfo.CurrentCulture, out result));
 }
Example #11
0
 public static Flexibility operator /(Area left, Energy right)
 {
     return(Flexibility.FromMetresPerNewton(left.squareMetres / right.joules));
 }
Example #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="Flexibility"/> that is the result from the division.</returns>
 public static Flexibility operator /(Wavenumber left, Pressure right)
 {
     return(Flexibility.FromMetresPerNewton(left.reciprocalMetres / right.pascals));
 }
 public static Flexibility operator /(double left, Stiffness right)
 {
     return(Flexibility.FromMetresPerNewton(left / right.newtonsPerMetre));
 }
Example #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="Flexibility"/> that is the result from the division.</returns>
 public static Flexibility operator /(Time left, MassFlow right)
 {
     return(Flexibility.FromMetresPerNewton(left.seconds / right.kilogramsPerSecond));
 }
Example #15
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="Flexibility"/> that is the result from the division.</returns>
 public static Flexibility operator /(LengthPerUnitless left, ForcePerUnitless right)
 {
     return(Flexibility.FromMetresPerNewton(left.metresPerUnitless / right.newtonsPerUnitless));
 }
 public static Flexibility operator /(Length left, Force right)
 {
     return(Flexibility.FromMetresPerNewton(left.metres / right.newtons));
 }