예제 #1
0
        /// <summary>
        /// Division operation, calculates value dividend/divisor with unit that derives from dividend unit
        /// </summary>
        /// <param name="mass">a dividend (counter) - a value that is being divided</param>
        /// <param name="linearDensity">a divisor (denominator) - a value which dividend is divided by</param>
        public static Length operator /(Mass mass, LinearDensity linearDensity)
        {
            // generator : MultiplyAlgebraGenerator.CreateCodeForRightFractionValue
            // scenario A
            // lineardensity unit will be synchronized with mass unit
            var unit = new LinearDensityUnit(mass.Unit, linearDensity.Unit.DenominatorUnit);
            var linearDensityConverted = linearDensity.WithCounterUnit(mass.Unit);
            var value = mass.Value / linearDensityConverted.Value;

            return(new Length(value, linearDensity.Unit.DenominatorUnit));
        }
예제 #2
0
        /// <summary>
        /// Division operation, calculates value dividend/divisor with unit that derives from dividend unit
        /// </summary>
        /// <param name="mass">a dividend (counter) - a value that is being divided</param>
        /// <param name="length">a divisor (denominator) - a value which dividend is divided by</param>
        public static LinearDensity operator /(Mass mass, Length length)
        {
            // generator : MultiplyAlgebraGenerator.CreateOperator
            // scenario with hint
            // .Is<Mass, Length, LinearDensity>("/")
            // hint location GetBasicOperatorHints, line 31
            var resultUnit = new LinearDensityUnit(mass.Unit, length.Unit);
            var value      = mass.Value / length.Value;

            return(new LinearDensity(value, resultUnit));
            // scenario F3
        }
예제 #3
0
 public bool Equals(LinearDensityUnit other)
 {
     return(CounterUnit.Equals(other.CounterUnit) && DenominatorUnit.Equals(other.DenominatorUnit));
 }