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); }
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); } }