InstituteforDiseaseModeling / covasim

COVID-19 Agent-based Simulator (Covasim): a model for exploring coronavirus dynamics and interventions
https://covasim.org
MIT License
250 stars 223 forks source link

Add state pattern to base.py #366

Closed edwardtang12 closed 3 years ago

edwardtang12 commented 3 years ago

Define class ResultsState and children classes ResultsNotReadyState and ResultsReadyState Change results_ready field of BaseSim to results_state, with results_ready() method in BaseSim Only set results_state to either ResultsNotReadyState and ResultsReadyState Delegate to_json and to_excel methods of BaseSim to those of results_state