コード例 #1
0
ファイル: Unit.cs プロジェクト: TenYearsADream/OpenCAD-1
        //Multiplication Operators
        private static DerivedUnit multiplyDerivedUnits(DerivedUnit a, DerivedUnit b)
        {
            var expression = new DerivedUnitDimension(a.Dimension.Members
                                                      .Concat(b.Dimension.Members).ToArray());

            return(new DerivedUnit(expression));
        }
コード例 #2
0
ファイル: Unit.cs プロジェクト: TenYearsADream/OpenCAD-1
        private static DerivedUnit exponentiateDerivedUnit(DerivedUnit a, double b)
        {
            var members = a.Dimension.Members.Select(m => new DerivedUnitDimensionMember(m.BaseUnit, m.Prefix,
                                                                                         m.Exponent * b)).ToArray();
            var expression = new DerivedUnitDimension(members);

            return(new DerivedUnit(expression));
        }
コード例 #3
0
 public DerivedUnit(string name, string symbol, string uiSymbol, DerivedUnitDimension expression)
 {
     _name     = name ?? throw new ArgumentNullException(nameof(name));
     _symbol   = symbol ?? throw new ArgumentNullException(nameof(symbol));
     _uiSymbol = uiSymbol;
     Dimension = expression ?? throw new ArgumentNullException(nameof(expression));
     IsNamed   = true;
 }
コード例 #4
0
 public DerivedUnit(DerivedUnitDimension expression)
 {
     _name     = null;
     _symbol   = null;
     _uiSymbol = null;
     Dimension = expression ?? throw new ArgumentNullException(nameof(expression));
     IsNamed   = false;
 }