public void Run() { Console.WriteLine("--Blackboard pattern--\n"); const int problemCount = 25; var itemsOfInterest = new List <ItemOfInterest>(); for (int i = 0; i < problemCount; i++) { itemsOfInterest.Add(new ItemOfInterest { Name = (i + 1).ToString() }); } var problems = new BlackboardRepository(itemsOfInterest); var controller = new Controller(problems); var scientist = new Thread(controller.ScientistWork); var economist = new Thread(controller.EconomistWork); var philosopher = new Thread(controller.PhilosopherWork); scientist.Start(); economist.Start(); philosopher.Start(); scientist.Join(); economist.Join(); philosopher.Join(); Console.WriteLine(); }
public ControlShell(BlackboardRepository blackboard) { _blackboard = blackboard; }
public Controller(BlackboardRepository repository) { _controllShell = new ControlShell(repository); }