Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

Enhance flexibility of getting/setting model properties #65

Merged
merged 9 commits into from
Jul 29, 2021
Merged

Enhance flexibility of getting/setting model properties #65

merged 9 commits into from
Jul 29, 2021

Conversation

fbanning
Copy link
Member

No description provided.

Checks for type of `model.properties` and uses correct approach to update values
Switch `update_abm_parameters!` function name with `update_abm_properties!` because the function updates `model.properties` and not the `params` of the interactive application
@Datseris
Copy link
Member

Okay, I think it is about time we port DrWatson's access function here... Let's just define a function set_value!(container, key, value) which dispatches to set index for arrays and dictionaries and to set property for anything else....... Otherwise you'll keep doing these bugfixes for the rest of your life xD

@fbanning
Copy link
Member Author

Never used DrWatson before. I'll have a look if I can make it work.

@fbanning
Copy link
Member Author

Sure, this is doable. I will implement three helper functions in utils.jl: has_value!, get_value!, and set_value!. Hopefully this will cover most (if not all) of our use cases.

Will push the changes to this PR here and rename it appropriately.

@fbanning fbanning changed the title Enable model.properties updates when using structs Enhance flexibility of getting/setting model properties Jul 29, 2021
src/utils.jl Outdated Show resolved Hide resolved
src/utils.jl Outdated Show resolved Hide resolved
@fbanning
Copy link
Member Author

Anything else you'd like me to incorporate into this PR?

@Datseris Datseris merged commit 80ca5ef into JuliaDynamics:master Jul 29, 2021
@fbanning fbanning deleted the property-updates branch July 29, 2021 11:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants