private static HashSet <ArabicRomanNumeral> GenerateAdditionalMappings(int offset, int length) { HashSet <ArabicRomanNumeral> additionalArabicRomanNumerals = new HashSet <ArabicRomanNumeral>(); foreach (int arabicNumeral in Enumerable.Range(offset, length)) { string romanNumeral; string arabicNumeralAsString; GenerateRomanNumerals(arabicNumeral, out romanNumeral, out arabicNumeralAsString); ArabicRomanNumeral arm = new ArabicRomanNumeral(arabicNumeral, arabicNumeralAsString, romanNumeral); additionalArabicRomanNumerals.Add(arm); } return(additionalArabicRomanNumerals); }
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); } }