コード例 #1
0
ファイル: UnitBase.cs プロジェクト: triozillion/UnitConverter
        /// <summary>
        /// Creates a new instance of a unit with a given multiple factor
        /// to it's base unit.
        /// Base units are the SI units, either base or derived.
        /// See the special implementation for details.
        /// </summary>
        /// <param name="multiple">The multiple of the base unit</param>
        /// <param name="baseUnit">The base unit for this unit</param>
        /// <exception cref="ArgumentNullException">Thrown, if either <paramref name="multiple"/> or <paramref name="baseUnit"/> is null.</exception>
        protected UnitBase(Multiple multiple, UnitBase baseUnit)
            : this(multiple.Factor, multiple.Symbol + baseUnit.Symbol)
        {
            if (Multiple == null)
            {
                throw new ArgumentNullException("multiple");
            }
            if (baseUnit == null)
            {
                throw new ArgumentNullException("baseUnit");
            }

            this.multiple = multiple;
        }
コード例 #2
0
 /// <summary>
 /// Creates multiples of the base unit, here gram.
 /// </summary>
 /// <param name="multiple">The multiple to apply to the base unit of gram.</param>
 public Gram(Multiple multiple)
     : base(multiple, new Gram())
 {
 }
コード例 #3
0
 /// <summary>
 /// Creats an new unit of a multiple of Volt
 /// </summary>
 /// <param name="multiple">The multiple that shall be applied to Volt.</param>
 public Volt(Multiple multiple) : base(multiple, new Volt())
 {
 }
コード例 #4
0
 /// <summary>
 /// Creates a multiple of 1 litre.
 /// </summary>
 /// <param name="multiple">The multiple to be applied to 1 litre.</param>
 public Litre(Multiple multiple)
     : base(multiple, new Litre())
 {
 }
コード例 #5
0
 /// <summary>
 /// Constructor for base units.
 /// </summary>
 /// <param name="multiple">The multiple that shall be applied to the base unit</param>
 public Coulomb(Multiple multiple)
     : base(multiple, new Coulomb())
 {
 }
コード例 #6
0
 /// <summary>
 /// Creates a new instance of a generic unit.
 /// </summary>
 /// <param name="multiple">The multiple to the base unit.</param>
 public GenericUnit(Multiple multiple)
     : base(multiple, new GenericUnit())
 {
 }
コード例 #7
0
ファイル: Second.cs プロジェクト: triozillion/UnitConverter
 /// <summary>
 /// Creates multiples of the base unit, here second
 /// </summary>
 /// <param name="multiple">The multiple to apply to the unit of seconds.</param>
 public Second(Multiple multiple)
     : base(multiple, new Second())
 {
 }
コード例 #8
0
 /// <summary>
 /// Creates a new instance of 1 Ohm.
 /// </summary>
 /// <param name="multiple">The multiple that shall be applied to the unit.</param>
 public Ohm(Multiple multiple)
     : base(multiple, new Ohm())
 {
 }
コード例 #9
0
 /// <summary>
 /// Creates a new multiple of Farad.
 /// </summary>
 /// <param name="multiple">The multiple of the unit.</param>
 public Farad(Multiple multiple) : base(multiple, new Farad())
 {
 }
コード例 #10
0
 /// <summary>
 /// Creates a new instance of a current unit.
 /// </summary>
 /// <param name="multiple">The multiple to the base unit.</param>
 public Ampere(Multiple multiple)
     : base(multiple, new Ampere())
 {
 }
コード例 #11
0
 /// <summary>
 /// Creates multiples of the base unit, here meter
 /// </summary>
 /// <param name="multiple">The multiple to apply to the base unit of meters.</param>
 /// <param name="unit">The unit the multiple shall be applied to.</param>
 protected LengthUnit(Multiple multiple, LengthUnit unit)
     : base(multiple, unit)
 {
 }
コード例 #12
0
 /// <summary>
 /// Creates a new instance of a current unit.
 /// </summary>
 /// <param name="multiple">The multiple to the base unit.</param>
 /// <param name="currentUnit">The unit the multiple shall be applied to.</param>
 protected CurrentUnit(Multiple multiple, CurrentUnit currentUnit)
     : base(multiple, currentUnit)
 {
 }
コード例 #13
0
 /// <summary>
 ///  Creates a new instance of the unit of 1 Henry
 /// </summary>
 /// <param name="multiple">The multiple that shall be applied to the base unit</param>
 public Henry(Multiple multiple)
     : base(multiple, new Henry())
 {
 }
コード例 #14
0
 /// <summary>
 /// Constructor for base units.
 /// </summary>
 /// <param name="multiple">The multiple that shall be applied to the base unit</param>
 /// <param name="baseUnit">The base unit.</param>
 protected CoherentUnitBase(Multiple multiple, UnitBase baseUnit)
     : base(multiple, baseUnit)
 {
 }
コード例 #15
0
ファイル: Meter.cs プロジェクト: triozillion/UnitConverter
 /// <summary>
 /// Creates multiples of the base unit, here meter
 /// </summary>
 /// <param name="multiple">The multiple to apply to the unit of meters.</param>
 public Meter(Multiple multiple)
     : base(multiple, new Meter())
 {
 }
コード例 #16
0
ファイル: Watt.cs プロジェクト: triozillion/UnitConverter
 /// <summary>
 /// Creats an new unit of a multiple of Watt
 /// </summary>
 /// <param name="multiple">The multiple that shall be applied to Watt.</param>
 public Watt(Multiple multiple) : base(multiple, new Watt())
 {
 }
コード例 #17
0
 /// <summary>
 /// Creates a new unit of 1 rotation, which is equivalent to 2 pi rad.
 /// </summary>
 public RotationUnit(Multiple multiple)
     : base(multiple, new RotationUnit())
 {
 }
コード例 #18
0
ファイル: Ton.cs プロジェクト: triozillion/UnitConverter
 /// <summary>
 /// Creates an new multiple of a ton.
 /// </summary>
 /// <param name="multiple">The multiple that shall be applied to ton. Should be > 10 only.</param>
 public Ton(Multiple multiple) : base(multiple, new Ton())
 {
 }