Esempio n. 1
0
        public Conversion SimplifyWith(ArabicToRomanPrimitive primitive)
        {
            var newArabic = RemainderArabic;
            var newRoman  = RomanNumber;

            while (newArabic >= primitive.MinimumApplicableNumber)
            {
                if (newArabic < primitive.Arabic)
                {
                    newRoman  += primitive.PreNumber.Roman;
                    newArabic -= primitive.MinimumApplicableNumber;
                }
                else
                {
                    newArabic -= primitive.Arabic;
                }

                newRoman += primitive.Roman;
            }

            return(From(newArabic, newRoman));
        }
Esempio n. 2
0
 protected ArabicToRomanPrimitive(int arabic, char roman, ArabicToRomanPrimitive preNumber)
 {
     Arabic    = arabic;
     Roman     = roman;
     PreNumber = preNumber;
 }
Esempio n. 3
0
 public static ArabicToRomanPrimitive From(int arabic, char roman, ArabicToRomanPrimitive preNumber) => new ArabicToRomanPrimitive(arabic, roman, preNumber);