public void OnProjectionScenarioCompleted(ProjectionScenario scenario, ProjectedFuture future) { // Pass the message to all output shims. foreach (OutputShim.IOutputShim outputShim in _outputShims) { outputShim.OnProjectionScenarioCompleted(scenario, future); } }
/** * @method Project the future for a ticket scenario. * @param scenario - The scenario to project into the future. * @returns An object that represents the projected outcome for future years if the given ticketing scenario is implemented. */ public ProjectedFuture Project(ProjectionScenario scenario) { // Create the object to contain our answer. ProjectedFuture future = new ProjectedFuture(_configuration); // Base these results on the highest year in our application. string highestYearNumber = _configuration.GetHighestYearNumber(); // Determine outcomes. DetermineOutcome(highestYearNumber, future.IfApplied, scenario); DetermineOutcome(highestYearNumber, future.IfNotApplied, null); // We are done computing. Return the result. return(future); }
/** * @method Perform data processing. * @params None * @returns None; output will be generated as a result of this activity. */ public void Run() { // Try to load our database from the on-disk cache. Data.Database database = _databaseCache.Load(); // Did we succeed? If not, load it manually via a connection to the database. if (database == null) { // Create a database to populate. database = new Data.Database(_configuration); Console.WriteLine("Gathering input data..."); // Populate the database using our input shim. _inputShim.SetDatabase(database); _inputShim.Run(); Console.WriteLine("All input data gathered."); // Save cache. _databaseCache.Save(database); } else { Console.WriteLine("Loaded cached input data from " + _databaseCache.Name); } // Create the object capable of projecting ticket scenarios into the future. Projector projector = new Projector(_configuration, database); // Start data processing. Start(); // Which scenarios will we test? List <ProjectionScenario> projectionScenarios = _configuration.GetProjectionScenarios(); foreach (ProjectionScenario projectionScenario in projectionScenarios) { // Project this scenario. ProjectedFuture projectionFuture = projector.Project(projectionScenario); // Inform our output shims of the result of this projection. OnProjectionScenarioCompleted(projectionScenario, projectionFuture); } // Finish data processing. End(); }