public SpecificHeatCapacity(decimal value, EnergyUnit energy, MassUnit mass, KelvinTemperatureUnit temperature) : this(value, new EnergyMassDensityUnit(energy, mass), temperature) { }
/// <summary> /// creates instance of InversedKelvinTemperatureUnit /// </summary> /// <param name="baseUnit">base unit</param> /// <param name="unitName">name of unit</param> public InversedKelvinTemperatureUnit(KelvinTemperatureUnit baseUnit, string unitName = null) { if (baseUnit is null) { throw new NullReferenceException(nameof(baseUnit)); } BaseUnit = baseUnit; unitName = unitName?.Trim(); UnitName = string.IsNullOrEmpty(unitName) ? "1/" + baseUnit.UnitName : unitName; }
public static InversedKelvinTemperatureUnit GetInversedKelvinTemperatureUnit(KelvinTemperatureUnit unit) { // generator : InversedUnitContainerGenerator.Add_GetInversedUnit for (var index = All.Count - 1; index >= 0; index--) { var tmp = All[index].Unit; if (unit.Equals(tmp.BaseUnit)) { return(tmp); } } throw new NotImplementedException("Not implemented yet"); }
public SpecificHeatCapacity WithDenominatorUnit(KelvinTemperatureUnit newUnit) { // generator : FractionValuesGenerator.Add_WithDenominatorUnit var oldUnit = Unit.DenominatorUnit; if (oldUnit == newUnit) { return(this); } var oldFactor = GlobalUnitRegistry.Factors.GetThrow(oldUnit); var newFactor = GlobalUnitRegistry.Factors.GetThrow(newUnit); var resultUnit = Unit.WithDenominatorUnit(newUnit); return(new SpecificHeatCapacity(newFactor / oldFactor * Value, resultUnit)); }
public MassDetlaKelvin WithRightUnit(KelvinTemperatureUnit newUnit) { // generator : ProductValuesGenerator.Add_WithDenominatorUnit var oldUnit = Unit.RightUnit; if (oldUnit == newUnit) { return(this); } var oldFactor = GlobalUnitRegistry.Factors.GetThrow(oldUnit); var newFactor = GlobalUnitRegistry.Factors.GetThrow(newUnit); var resultUnit = Unit.WithRightUnit(newUnit); return(new MassDetlaKelvin(newFactor / oldFactor * Value, resultUnit)); }
public static MassDetlaKelvin Parse(string value) { // generator : ProductValuesGenerator.Add_Parse if (string.IsNullOrEmpty(value)) { throw new ArgumentNullException(nameof(value)); } var r = CommonParse.Parse(value, typeof(MassDetlaKelvin)); var units = Common.SplitUnitNameByTimesSign(r.UnitName); if (units.Length != 2) { throw new Exception($"{r.UnitName} is not valid MassDetlaKelvin unit"); } var counterUnit = new MassUnit(units[0]); var denominatorUnit = new KelvinTemperatureUnit(units[1]); return(new MassDetlaKelvin(r.Value, counterUnit, denominatorUnit)); }
public SpecificHeatCapacity(decimal value, EnergyMassDensityUnit counterUnit, KelvinTemperatureUnit denominatorUnit) { Value = value; Unit = new SpecificHeatCapacityUnit(counterUnit, denominatorUnit); }
public MassDetlaKelvin(decimal value, MassUnit leftUnit, KelvinTemperatureUnit rightUnit) { Value = value; Unit = new MassDetlaKelvinUnit(leftUnit, rightUnit); }