//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)); }
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)); }
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; }
public DerivedUnit(DerivedUnitDimension expression) { _name = null; _symbol = null; _uiSymbol = null; Dimension = expression ?? throw new ArgumentNullException(nameof(expression)); IsNamed = false; }