//------------------------------------------------------------------------- // setup calculation runner component, which needs life-cycle management // a typical application might use dependency injection to obtain the instance private static Pair <IList <Trade>, Results> calculate() { using (CalculationRunner runner = CalculationRunner.ofMultiThreaded()) { return(calculate(runner)); } }
//------------------------------------------------------------------------- public virtual void test_of() { using (CalculationRunner test = CalculationRunner.ofMultiThreaded()) { assertThat(test.TaskRunner).NotNull; } }
/// <summary> /// Runs the example, pricing the instruments, producing the output as an ASCII table. /// </summary> /// <param name="args"> ignored </param> public static void Main(string[] args) { // setup calculation runner component, which needs life-cycle management // a typical application might use dependency injection to obtain the instance using (CalculationRunner runner = CalculationRunner.ofMultiThreaded()) { calculate(runner); } }
/// <summary> /// Runs the tool. /// </summary> /// <param name="args"> the command-line arguments </param> public static void Main(string[] args) { using (ReportRunnerTool reportRunner = new ReportRunnerTool(CalculationRunner.ofMultiThreaded())) { JCommander commander = new JCommander(reportRunner); commander.ProgramName = typeof(ReportRunnerTool).Name; try { commander.parse(args); } catch (ParameterException e) { Console.Error.WriteLine("Error: " + e.Message); Console.Error.WriteLine(); commander.usage(); return; } if (reportRunner.help) { commander.usage(); } else if (reportRunner.version) { string versionName = typeof(ReportRunnerTool).Assembly.ImplementationVersion; if (string.ReferenceEquals(versionName, null)) { versionName = "unknown"; } Console.WriteLine("Strata Report Runner Tool, version " + versionName); } else { try { reportRunner.run(); } catch (Exception e) { Console.Error.WriteLine(Messages.format("Error: {}\n", e.Message)); commander.usage(); } } } }