Beispiel #1
0
        private static int GetLowerPowerOfTenRomanNumeralValue(int lowerRomanNumeralValue, int upperRomanNumeralValue)
        {
            int lowerPowerOfTenRomanNumeralValue = lowerRomanNumeralValue;

            if (MathCalculator.IsValuePowerOfTen(upperRomanNumeralValue))
            {
                lowerPowerOfTenRomanNumeralValue = GetNextLowerPowerOfTenRomanNumeral(lowerRomanNumeralValue);
            }
            return(lowerPowerOfTenRomanNumeralValue);
        }
Beispiel #2
0
        private static int GetNextLowerPowerOfTenRomanNumeral(int currentValue)
        {
            int lowerPowerOfTenRomanNumeralValue = 0;

            if (MathCalculator.IsValuePowerOfTen(currentValue))
            {
                lowerPowerOfTenRomanNumeralValue = currentValue;
            }
            else
            {
                int lowerRomanNumeralIndex = RomanNumerals.IndexOfValue(currentValue);
                for (int i = lowerRomanNumeralIndex; i >= 0; i--)
                {
                    int currentRomanNumeralValue = GetRomanNumeralValueAtIndex(i);
                    if (MathCalculator.IsValuePowerOfTen(currentRomanNumeralValue))
                    {
                        lowerPowerOfTenRomanNumeralValue = currentRomanNumeralValue;
                        break;
                    }
                }
            }
            return(lowerPowerOfTenRomanNumeralValue);
        }