Example #1
0
        public double MeasureToBasicUnit(MeasureUnit unit, double value)
        {
            if (unit is BasicMeasureUnit basicUnit)
            {
                return(basicUnit.MeasureToBasicUnit(value));
            }

            if (unit is CoefficientMeasureUnit coeffientUnit)
            {
                return(coeffientUnit.MeasureToBasicUnit(value));
            }

            if (unit is FormulatedMeasureUnit formulatedUnit)
            {
                return(formulatedUnit.MeasureToBasicUnit(value, _formulaExpressionEvaluator));
            }

            throw new InvalidMeasureUnit($"type: {unit.GetType()}");
        }