public UnitDimensions(double scale, IUnitType numerator = null, IUnitType denominator = null)
 {
     this.ConversionFactor = scale;
     this._dimensions = new int[FundamentalUnitCount];
     
     if (numerator != null)
     {
         this.ConversionFactor *= numerator.ConversionFactor;
         AddTo(this._dimensions, numerator.Dimensions._dimensions);
     }
     if (denominator != null)
     {
         this.ConversionFactor /= denominator.ConversionFactor;
         SubtractFrom(this._dimensions, denominator.Dimensions._dimensions);
     }
 }
Пример #2
0
        public UnitDimensions(double scale, IUnitType numerator = null, IUnitType denominator = null)
        {
            this.ConversionFactor = scale;
            this._dimensions      = new int[FundamentalUnitCount];

            if (numerator != null)
            {
                this.ConversionFactor *= numerator.ConversionFactor;
                AddTo(this._dimensions, numerator.Dimensions._dimensions);
            }
            if (denominator != null)
            {
                this.ConversionFactor /= denominator.ConversionFactor;
                SubtractFrom(this._dimensions, denominator.Dimensions._dimensions);
            }
        }
Пример #3
0
 public double ValueIn(IUnitType unitType)
 {
     return(this.Measurement.Value * ConversionFromThisTo(unitType));
 }
Пример #4
0
        public Measurement MeasurementIn(IUnitType unitType)
        {
            var result = this.Measurement * ConversionFromThisTo(unitType);

            return(result);
        }
Пример #5
0
 public double ConversionFromThisTo(IUnitType unit)
 {
     return(this.ConversionFactor / unit.ConversionFactor);
 }
Пример #6
0
 public double ConversionFromThisTo(IUnitType unit)
 {
     return this.ConversionFactor / unit.ConversionFactor;
 }
Пример #7
0
 public double ValueIn(IUnitType unitType)
 {
     return this.Measurement.Value*ConversionFromThisTo(unitType);
 }
Пример #8
0
 public Measurement MeasurementIn(IUnitType unitType)
 {
     var result = this.Measurement * ConversionFromThisTo(unitType);
     return result;
 }