|
From: SourceForge.net <no...@so...> - 2005-07-12 21:28:50
|
Bugs item #1232750, was opened at 2005-07-05 08:33 Message generated for change (Settings changed) made by jerryvos You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101703&aid=1232750&group_id=1703 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Nick Collier (srcnick) Assigned to: Nobody/Anonymous (nobody) Summary: BaseController SimEvents Initial Comment: From Charles Gieseler: I wanted to ask something about a problem I found in the BaseController. I noticed that BaseController doesn't fire SimEvents to SimEventListeners when a simulatoin is paused or stopped. I checked the source and it appears that pauseSim() and stopSim() are missing calls to fireSimEvent(). This is used in startSim(), which my listener does pick up correctly. I tried adding a call to fireSimEvent() to both pauseSim() and stopSim() with the corresponding event flags from SimEvent. My listener seem to pick them up as intended with this modification. I also noticed a flag in SimEvent for when the seed for the random generator is set. I assumed this meant setRandomSeed() should also fire a SimEvent. I wasn't sure if I should submit this as a bug report or do something else, so I thought I would check with you first. I have attached BaseController with my changes if you want to take a look. I have marked each change with the comment "//****** ADDED fireSimEvent() HERE". ---------------------------------------------------------------------- >Comment By: Jerry Vos (jerryvos) Date: 2005-07-12 16:28 Message: Logged In: YES user_id=1093815 I have looked into this and found the reasoning for pauseSim and StopSim not firing events. The reason this doesn't happen is because the pauseSim and stopSim methods do not actually pause the simulation. The simulation and the controller thread runs in its own thread, the Controller's stopSim and pauseSim methods notify this thread (through the pauseSim/stopSim flags) if it should pause or stop. However, the thread only is notifying the model of this, not all the listeners, therefore I've changed this so that all listeners are notified. This should work fine, however if the controller for some reason is set to be listening to its own events it may get caught in itself. However, even in this case it should be fine since the only time an event would be fired again is in the run loop which should result in it ignoring multiple calls. Also, I've added fireSimEvent(new SimEvent(this, SimEvent.RNG_SEED_EVENT)); to setRandomSeed, because as Charles pointed out, it should probably be happening. ---------------------------------------------------------------------- Comment By: Nick Collier (srcnick) Date: 2005-07-05 08:34 Message: Logged In: YES user_id=7167 I'm not sure if the BaseController should fire the events. Perhaps the idea was (is?) that child classes would implement that. Seems strange though. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101703&aid=1232750&group_id=1703 |