public static InterpFactory <T> ResolveInterp <T>(bool checks) { if (checks) { return((InterpFactory <T>)InterpChecked.Find <T>()); } var factory = InterpSupport.Find <T>(); if (factory == null) { return((s, a, c) => new InterpretImpl <T, UnknownArithmetic <T> >(s, a, c)); } return((InterpFactory <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); } }