Closed pan64271 closed 2 years ago
Hi @pan64271 it has been a while since I wrote the code, however in Clock.cs the observers are stored within a HashSet
, so there shouldn't be need to check if they're existing already
Hi @pan64271 it has been a while since I wrote the code, however in Clock.cs the observers are stored within a
HashSet
, so there shouldn't be need to check if they're existing already
OK, I got your point. Thanks for your reply!
I have encountered a question while reading the source code. I'm not sure whether it's a bug or designed like that intentionally, so I just list it out here. If it's the latter case, I would be pleased if someone could tell me the intention behind it.
In methods
AddObserver
andRemoveObserver
in Blackboard.cs, before add/remove a observer, it will check whether there is already a add/ remove request inaddObservers
/removeObservers
. If so, this request will be ignored.But in methods
AddUpdateObserver
andRemoveUpdateObserver
in Clock.cs, before add/remove a observer, it does not check the same thing, which means that there could be two remove requests for the same observer.So, what's the intention of this difference?
Thanks.