//---------------------------------------------------------------------------------------- // SimulationDisplays Constructer | Parameters : Object, ISImulationDataSubject //---------------------------------------------------------------------------------------- public SimulationDisplays(Object displayObject,ISimulationDataSubject simData) { //Initalize variables this.simData = simData; this.displayObject = displayObject; simCurrentState = null; }
//---------------------------------------------------------------------------------------- // NotifyObserver Method | Parameters : Object, ISImulationDataSubject //---------------------------------------------------------------------------------------- public void NotifyObserver(Simulator sim) { //Iterate over the list of obserbers updating the data they need foreach (IDisplayObserver currentObserver in simulationDisplayObserverList) { currentObserver.Update(sim); } }
//---------------------------------------------------------------------------------------- // Update Method | Parameters : Simulator //---------------------------------------------------------------------------------------- public override void Update(Simulator sim) { //make the simCurrenState = to the simulate at the current moment upadte is called simCurrentState = sim; //displaythe data DisplayData(); }
private void btnRun_Click(object sender, EventArgs e) { //set the parameters setParameters(); //check wheter or not they are wanting graphical display or text based display ViewSelection(); //create the simulation theSim = new Simulator(simulationData,statsData); //initalize the simulation theSim.Initialize(); //run the simulation theSim.RunSimulation(); }
//---------------------------------------------------------------------------------------- // UpdateSystemStats | Parameters : Simulator //---------------------------------------------------------------------------------------- public void UpdateSystemStats(Simulator theSim) { //Update list of stereo calls in queue at that poin in time by adding it to NumInStereoQueue int stereoQueueLength = theSim.theQueueManager.QueueLength(eCallType.StereoCall); NumInStereoQueue.Add(stereoQueueLength); //Update list of other calls in queue at that poin in time by adding it to NumInOtherQueue int otherQueueLength = theSim.theQueueManager.QueueLength(eCallType.OtherCall); NumInOtherQueue.Add(otherQueueLength); //Update list of other reps who are busy by adding the ammount at that time to OtherUtilisation int busyOtherRep = theSim.TheSalesRepManager.NumberOfBusyReps(eCallType.OtherCall); OtherUtilisation.Add(busyOtherRep); //Update list of stereo reps who are busy by adding the ammount at that time to StereoUtilisation int busyStereoRep = theSim.TheSalesRepManager.NumberOfBusyReps(eCallType.StereoCall); StereoUtilisation.Add(busyStereoRep); }
//---------------------------------------------------------------------------------------- // Update Method | Parameters : Simulator //---------------------------------------------------------------------------------------- public abstract void Update(Simulator sim);