Пример #1
0
        public static QuickFactory <T> ResolveQuick <T>(bool checks)
        {
            if (checks)
            {
                return((QuickFactory <T>)QuickChecked.Find <T>());
            }

            var factory = QuickSupport.Find <T>();

            if (factory == null)
            {
                return(args =>
                       new QuickInterpretImpl <T, UnknownArithmetic <T> >(args));
            }

            return((QuickFactory <T>)factory);
        }
Пример #2
0
        static void Register <T, TSupport>(bool checks)
            where TSupport : IArithmetic <T>, new()
        {
            InterpFactory <T> interpFactory =
                (s, a, c) => new InterpretImpl <T, TSupport>(s, a, c);

            QuickFactory <T> quickFactory =
                args => new QuickInterpretImpl <T, TSupport>(args);

            if (checks)
            {
                QuickChecked.Add <T>(quickFactory);
                InterpChecked.Add <T>(interpFactory);
            }
            else
            {
                QuickSupport.Add <T>(quickFactory);
                InterpSupport.Add <T>(interpFactory);
            }
        }