Example #1
0
        private static Dictionary <SimpleArabicNumeral, SimpleRomanNumeral> GenerateAdditionalSimpleNumerals(int offset,
                                                                                                             int length)
        {
            Dictionary <SimpleArabicNumeral, SimpleRomanNumeral> moreNumerals = new Dictionary <SimpleArabicNumeral, SimpleRomanNumeral>();

            foreach (int arabicNumeral in Enumerable.Range(offset, length))
            {
                string romanNumeral;
                string arabicNumeralAsString;
                GenerateRomanNumerals(arabicNumeral, out romanNumeral, out arabicNumeralAsString);
                SimpleArabicNumeral san = new SimpleArabicNumeral(arabicNumeral);
                SimpleRomanNumeral  srn = new SimpleRomanNumeral(romanNumeral);
                moreNumerals.Add(san, srn);
            }
            return(moreNumerals);
        }
Example #2
0
        private static void PopluateDictionariesReasonablyLarge()
        {
            if (_simpleArabicNumeralMappings != null || _arabicRomanNumeralsMapping != null)
            {
                return;
            }
            _arabicRomanNumeralsMapping  = new HashSet <ArabicRomanNumeral>();
            _simpleArabicNumeralMappings = new Dictionary <SimpleArabicNumeral, SimpleRomanNumeral>();
            foreach (int arabicNumeral in Enumerable.Range(1, DICTIONARY_PREPOPULATION_SIZE + 1))
            {
                string romanNumeralAsString, arabicNumeralAsString;
                GenerateRomanNumerals(arabicNumeral, out romanNumeralAsString, out arabicNumeralAsString);
                ArabicRomanNumeral arm = new ArabicRomanNumeral(arabicNumeral, arabicNumeralAsString, romanNumeralAsString);
                _arabicRomanNumeralsMapping.Add(arm);

                SimpleArabicNumeral sam = new SimpleArabicNumeral(arabicNumeral);
                SimpleRomanNumeral  srm = new SimpleRomanNumeral(romanNumeralAsString);
                _simpleArabicNumeralMappings.Add(sam, srm);
            }
        }