internal UnitSystem(string name, IUnitFactory unitFactory, IUnitDialect dialect) { Check.Argument(name, nameof(name)).IsNotNull(); Check.Argument(unitFactory, nameof(unitFactory)).IsNotNull(); Check.Argument(dialect, nameof(dialect)).IsNotNull(); this.unitFactory = unitFactory; this.dialect = dialect; this.Name = name; this.baseUnits = new Dictionary<Dimension, KnownUnit>(); this.coherentUnits = new Dictionary<Dimension, Unit>(); this.units = new Dictionary<Tuple<double, Dimension>, KnownUnit>(); this.unitsBySymbol = new Dictionary<string, KnownUnit>(); this.NoUnit = new DerivedUnit(this, 1, Dimension.DimensionLess); }
public UnitInterpretor(IUnitSystem system, IUnitDialect dialect) { this.system = system; this.dialect = dialect; this.unitRegex = BuildUnitRegex(); this.baseUnits = new List<KnownUnit>(this.system.BaseUnits); foreach (var unit in system) { if (unit.Symbol != unit.BaseSymbol) { this.prefixedUnits.Add(unit.BaseSymbol, unit); } } }
public UnitInterpretor(IUnitSystem system, IUnitDialect dialect) { this.system = system; this.dialect = dialect; this.unitRegex = BuildUnitRegex(); this.baseUnits = new List <KnownUnit>(this.system.BaseUnits); foreach (var unit in system) { if (unit.Symbol != unit.BaseSymbol) { this.prefixedUnits.Add(unit.BaseSymbol, unit); } } }
internal UnitSystem(string name, IUnitFactory unitFactory, IUnitDialect dialect) { Check.Argument(name, nameof(name)).IsNotNull(); Check.Argument(unitFactory, nameof(unitFactory)).IsNotNull(); Check.Argument(dialect, nameof(dialect)).IsNotNull(); this.unitFactory = unitFactory; this.dialect = dialect; this.Name = name; this.baseUnits = new Dictionary <Dimension, KnownUnit>(); this.coherentUnits = new Dictionary <Dimension, Unit>(); this.units = new Dictionary <Tuple <double, Dimension>, KnownUnit>(); this.unitsBySymbol = new Dictionary <string, KnownUnit>(); this.NoUnit = new DerivedUnit(this, 1, Dimension.DimensionLess); }
public UnitSystem(string name, IUnitDialect dialect) : this(name, new UnitFactory(), dialect) { }