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)); }
protected ArabicToRomanPrimitive(int arabic, char roman, ArabicToRomanPrimitive preNumber) { Arabic = arabic; Roman = roman; PreNumber = preNumber; }
public static ArabicToRomanPrimitive From(int arabic, char roman, ArabicToRomanPrimitive preNumber) => new ArabicToRomanPrimitive(arabic, roman, preNumber);