コード例 #1
0
        /// <devdoc>
        /// <para>Converts the given object to a <see cref='Gu.Units.Jerk'/>
        /// object.</para>
        /// </devdoc>
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            var text = value as string;

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

            return(base.ConvertFrom(context, culture, value));
        }
コード例 #2
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 Jerk(XmlConvert.ToDouble(attribute), JerkUnit.MetresPerSecondCubed);
            reader.ReadStartElement();
        }
コード例 #3
0
 public static Jerk operator *(Frequency left, Acceleration right)
 {
     return(Jerk.FromMetresPerSecondCubed(left.hertz * right.metresPerSecondSquared));
 }
コード例 #4
0
ファイル: Jerk.generated.cs プロジェクト: pockees/Gu.Units
 /// <summary>
 /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Jerk"/> object within the given tolerance.
 /// </summary>
 /// <returns>
 /// true if <paramref name="other"/> represents the same Jerk as this instance; otherwise, false.
 /// </returns>
 /// <param name="other">An instance of <see cref="Gu.Units.Jerk"/> 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(Jerk other, Jerk tolerance)
 {
     Ensure.GreaterThan(tolerance.metresPerSecondCubed, 0, nameof(tolerance));
     return(Math.Abs(this.metresPerSecondCubed - other.metresPerSecondCubed) < tolerance.metresPerSecondCubed);
 }
コード例 #5
0
ファイル: Jerk.generated.cs プロジェクト: pockees/Gu.Units
 /// <summary>
 /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Jerk"/> object.
 /// </summary>
 /// <returns>
 /// true if <paramref name="other"/> represents the same Jerk as this instance; otherwise, false.
 /// </returns>
 /// <param name="other">An instance of <see cref="Gu.Units.Jerk"/> object to compare with this instance.</param>
 public bool Equals(Jerk other)
 {
     return(this.metresPerSecondCubed.Equals(other.metresPerSecondCubed));
 }
コード例 #6
0
ファイル: Jerk.generated.cs プロジェクト: pockees/Gu.Units
 /// <summary>
 /// Compares this instance to a specified <see cref="Gu.Units.Jerk"/> 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.Jerk"/> 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.Jerk"/> object to compare to this instance.</param>
 public int CompareTo(Jerk quantity)
 {
     return(this.metresPerSecondCubed.CompareTo(quantity.metresPerSecondCubed));
 }
コード例 #7
0
ファイル: Jerk.generated.cs プロジェクト: pockees/Gu.Units
 /// <summary>
 /// Creates an instance of <see cref="Gu.Units.Jerk"/> from its string representation
 /// </summary>
 /// <param name="text">The string representation of the <see cref="Gu.Units.Jerk"/></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="Jerk"/></param>
 /// <returns>True if an instance of <see cref="Jerk"/> could be parsed from <paramref name="text"/></returns>
 public static bool TryParse(string text, NumberStyles styles, IFormatProvider provider, out Jerk result)
 {
     return(QuantityParser.TryParse <JerkUnit, Jerk>(text, From, styles, provider, out result));
 }
コード例 #8
0
ファイル: Jerk.generated.cs プロジェクト: pockees/Gu.Units
 /// <summary>
 /// Creates an instance of <see cref="Gu.Units.Jerk"/> from its string representation
 /// </summary>
 /// <param name="text">The string representation of the <see cref="Gu.Units.Jerk"/></param>
 /// <param name="styles">Specifies the <see cref="NumberStyles"/> to be used.</param>
 /// <param name="result">The parsed <see cref="Jerk"/></param>
 /// <returns>True if an instance of <see cref="Jerk"/> could be parsed from <paramref name="text"/></returns>
 public static bool TryParse(string text, NumberStyles styles, out Jerk result)
 {
     return(QuantityParser.TryParse <JerkUnit, Jerk>(text, From, styles, CultureInfo.CurrentCulture, out result));
 }
コード例 #9
0
 public static Jerk operator /(Acceleration left, Time right)
 {
     return(Jerk.FromMetresPerSecondCubed(left.metresPerSecondSquared / right.seconds));
 }