private static IEnumerable <RomanSymbol> CreateRepetition(RomanSymbol romanSymbol, int count = 1) =>
        !romanSymbol.IsRepitable || count == 1
            ? new RomanSymbol[]
        {
            romanSymbol
        }

            : Enumerable.Repeat(romanSymbol, count);
        public static int CalculateNumberOfOcurrances(RomanSymbol romanSymbol, ArabicNumber arabic)
        {
            if (arabic.Equals(ArabicNumber.Zero))
            {
                return(0);
            }
            var result = arabic.DevidedBy(romanSymbol);

            return(result);
        }
        public static RomanSymbolRepetition FromOcurrancesOfSymbol(RomanSymbol romanSymbol, ArabicNumber arabic)
        {
            if (!CanCreateRepetition(romanSymbol, arabic))
            {
                return(Empty);
            }
            var count = CalculateNumberOfOcurrances(romanSymbol, arabic);

            return(new RomanSymbolRepetition(romanSymbol, count));
        }
Ejemplo n.º 4
0
 public static bool TryParse(string romanRaw, out RomanSymbol romanSymbol)
 {
     romanSymbol = Parse(romanRaw);
     return(romanSymbol != null);
 }
 public static bool CanCreateRepetition(RomanSymbol romanSymbol, int num) =>
 romanSymbol.IsSmallerOrEqualTo(num);
 public static bool CanCreateRepetition(RomanSymbol romanSymbol, ArabicNumber arabic) =>
 CanCreateRepetition(romanSymbol, arabic.Value);
 public static object CanCreateRepetition(RomanSymbol v, object arabic)
 {
     throw new System.NotImplementedException();
 }
 public RomanSymbolRepetition(RomanSymbol romanSymbol, int count = 1)
 {
     Items = CreateRepetition(romanSymbol, count);
 }