1
1
# ## Handles Independent Variables ###
2
2
3
- # Checks if the reaction system have any independent variable. True for all valid reaction systems.
4
- function has_iv (rn:: ReactionSystem )
3
+ # Checks if the reaction system has any independent variable. True for all valid reaction systems.
4
+ function seri_has_iv (rn:: ReactionSystem )
5
5
return true
6
6
end
7
7
@@ -17,13 +17,13 @@ function get_iv_annotation(rn::ReactionSystem)
17
17
end
18
18
19
19
# Combines the 3 independent variable-related functions in a constant tuple.
20
- IV_FS = (has_iv , get_iv_string, get_iv_annotation)
20
+ IV_FS = (seri_has_iv , get_iv_string, get_iv_annotation)
21
21
22
22
23
23
# ## Handles Spatial Independent Variables ###
24
24
25
- # Checks if the reaction system have any spatial independent variables.
26
- function has_sivs (rn:: ReactionSystem )
25
+ # Checks if the reaction system has any spatial independent variables.
26
+ function seri_has_sivs (rn:: ReactionSystem )
27
27
return ! isempty (get_sivs (rn))
28
28
end
29
29
@@ -38,23 +38,23 @@ function get_sivs_annotation(rn::ReactionSystem)
38
38
end
39
39
40
40
# Combines the 3 independent variables-related functions in a constant tuple.
41
- SIVS_FS = (has_sivs , get_sivs_string, get_sivs_annotation)
41
+ SIVS_FS = (seri_has_sivs , get_sivs_string, get_sivs_annotation)
42
42
43
43
44
44
# ## Handles Species, Variables, and Parameters ###
45
45
46
46
# Function which handles the addition of species, variable, and parameter declarations to the file
47
47
# text. These must be handled as a unity in case there are default value dependencies between these.
48
48
function handle_us_n_ps (file_text:: String , rn:: ReactionSystem , annotate:: Bool , top_level:: Bool )
49
- # Fetches the systems parameters, species, and variables. Computes the `has_` `Bool`s.
49
+ # Fetches the system's parameters, species, and variables. Computes the `has_` `Bool`s.
50
50
ps_all = get_ps (rn)
51
51
sps_all = get_species (rn)
52
52
vars_all = filter (! isspecies, get_unknowns (rn))
53
- has_ps = has_parameters (rn)
54
- has_sps = has_species (rn)
55
- has_vars = has_variables (rn)
53
+ has_ps = seri_has_parameters (rn)
54
+ has_sps = seri_has_species (rn)
55
+ has_vars = seri_has_variables (rn)
56
56
57
- # Checks which sets have dependencies which requires managing.
57
+ # Checks which sets have dependencies which require managing.
58
58
p_deps = any (depends_on (p, [ps_all; sps_all; vars_all]) for p in ps_all)
59
59
sp_deps = any (depends_on (sp, [sps_all; vars_all]) for sp in sps_all)
60
60
var_deps = any (depends_on (var, vars_all) for var in vars_all)
@@ -93,7 +93,7 @@ function handle_us_n_ps(file_text::String, rn::ReactionSystem, annotate::Bool, t
93
93
94
94
# Pre-declares the sets with written/remaining parameters/species/variables.
95
95
# Whenever all/none are written depends on whether there were any initial dependencies.
96
- # `deepcopy` is required as these gets mutated by `dependency_split!`.
96
+ # `deepcopy` is required as these get mutated by `dependency_split!`.
97
97
remaining_ps = (p_deps ? deepcopy (ps_all) : [])
98
98
remaining_sps = (sp_deps ? deepcopy (sps_all) : [])
99
99
remaining_vars = (var_deps ? deepcopy (vars_all) : [])
@@ -113,7 +113,7 @@ function handle_us_n_ps(file_text::String, rn::ReactionSystem, annotate::Bool, t
113
113
isempty (writable_vars) || @string_append! us_n_ps_string get_variables_string (writable_vars) " \n "
114
114
end
115
115
116
- # For parameters, species, and/or variables with dependencies, creates final vectors.
116
+ # For parameters, species, and/or variables with dependencies, create final vectors.
117
117
p_deps && (@string_append! us_n_ps_string " ps = " syms_2_strings (ps_all) " \n " )
118
118
sp_deps && (@string_append! us_n_ps_string " sps = " syms_2_strings (sps_all) " \n " )
119
119
var_deps && (@string_append! us_n_ps_string " vars = " syms_2_strings (vars_all) " \n " )
@@ -127,17 +127,17 @@ function handle_us_n_ps(file_text::String, rn::ReactionSystem, annotate::Bool, t
127
127
us_n_ps_string = replace (us_n_ps_string, " \n vars = " => " \n local vars = " )
128
128
end
129
129
130
- # Merges the file text with `us_n_ps_string` and return the final outputs.
130
+ # Merges the file text with `us_n_ps_string` and returns the final outputs.
131
131
return file_text * us_n_ps_string, has_ps, has_sps, has_vars
132
132
end
133
133
134
134
135
135
# ## Handles Parameters ###
136
- # Unlike most other fields, there are not called via `push_field`, but rather via `handle_us_n_ps`.
136
+ # Unlike most other fields, these are not called via `push_field`, but rather via `handle_us_n_ps`.
137
137
# Hence they work slightly differently.
138
138
139
- # Checks if the reaction system have any parameters.
140
- function has_parameters (rn:: ReactionSystem )
139
+ # Checks if the reaction system has any parameters.
140
+ function seri_has_parameters (rn:: ReactionSystem )
141
141
return ! isempty (get_ps (rn))
142
142
end
143
143
@@ -156,11 +156,11 @@ end
156
156
157
157
158
158
# ## Handles Species ###
159
- # Unlike most other fields, there are not called via `push_field`, but rather via `handle_us_n_ps`.
159
+ # Unlike most other fields, these are not called via `push_field`, but rather via `handle_us_n_ps`.
160
160
# Hence they work slightly differently.
161
161
162
- # Checks if the reaction system have any species.
163
- function has_species (rn:: ReactionSystem )
162
+ # Checks if the reaction system has any species.
163
+ function seri_has_species (rn:: ReactionSystem )
164
164
return ! isempty (get_species (rn))
165
165
end
166
166
@@ -179,11 +179,11 @@ end
179
179
180
180
181
181
# ## Handles Variables ###
182
- # Unlike most other fields, there are not called via `push_field`, but rather via `handle_us_n_ps`.
182
+ # Unlike most other fields, these are not called via `push_field`, but rather via `handle_us_n_ps`.
183
183
# Hence they work slightly differently.
184
184
185
- # Checks if the reaction system have any variables.
186
- function has_variables (rn:: ReactionSystem )
185
+ # Checks if the reaction system has any variables.
186
+ function seri_has_variables (rn:: ReactionSystem )
187
187
return length (get_unknowns (rn)) > length (get_species (rn))
188
188
end
189
189
@@ -201,13 +201,13 @@ function get_variables_annotation(rn::ReactionSystem)
201
201
end
202
202
203
203
# Combines the 3 variables-related functions in a constant tuple.
204
- VARIABLES_FS = (has_variables , get_variables_string, get_variables_annotation)
204
+ VARIABLES_FS = (seri_has_variables , get_variables_string, get_variables_annotation)
205
205
206
206
207
207
# ## Handles Reactions ###
208
208
209
- # Checks if the reaction system have any reactions.
210
- function has_reactions (rn:: ReactionSystem )
209
+ # Checks if the reaction system has any reactions.
210
+ function seri_has_reactions (rn:: ReactionSystem )
211
211
return length (reactions (rn)) != 0
212
212
end
213
213
@@ -265,14 +265,14 @@ function get_reactions_annotation(rn::ReactionSystem)
265
265
return " Reactions:"
266
266
end
267
267
268
- # Combines the 3 reactions -related functions in a constant tuple.
269
- REACTIONS_FS = (has_reactions , get_reactions_string, get_reactions_annotation)
268
+ # Combines the 3 reaction -related functions in a constant tuple.
269
+ REACTIONS_FS = (seri_has_reactions , get_reactions_string, get_reactions_annotation)
270
270
271
271
272
272
# ## Handles Equations ###
273
273
274
- # Checks if the reaction system have any equations.
275
- function has_equations (rn:: ReactionSystem )
274
+ # Checks if the reaction system has any equations.
275
+ function seri_has_equations (rn:: ReactionSystem )
276
276
return length (get_eqs (rn)) > length (get_rxs (rn))
277
277
end
278
278
@@ -302,13 +302,13 @@ function get_equations_annotation(rn::ReactionSystem)
302
302
end
303
303
304
304
# Combines the 3 equations-related functions in a constant tuple.
305
- EQUATIONS_FS = (has_equations , get_equations_string, get_equations_annotation)
305
+ EQUATIONS_FS = (seri_has_equations , get_equations_string, get_equations_annotation)
306
306
307
307
308
308
# ## Handles Observables ###
309
309
310
- # Checks if the reaction system have any observables.
311
- function has_observed (rn:: ReactionSystem )
310
+ # Checks if the reaction system has any observables.
311
+ function seri_has_observed (rn:: ReactionSystem )
312
312
return ! isempty (observed (rn))
313
313
end
314
314
@@ -353,13 +353,13 @@ function get_observed_annotation(rn::ReactionSystem)
353
353
end
354
354
355
355
# Combines the 3 -related functions in a constant tuple.
356
- OBSERVED_FS = (has_observed , get_observed_string, get_observed_annotation)
356
+ OBSERVED_FS = (seri_has_observed , get_observed_string, get_observed_annotation)
357
357
358
358
359
359
# ## Handles Continuous Events ###
360
360
361
- # Checks if the reaction system have any continuous events.
362
- function has_continuous_events (rn:: ReactionSystem )
361
+ # Checks if the reaction system have has continuous events.
362
+ function seri_has_continuous_events (rn:: ReactionSystem )
363
363
return ! isempty (MT. get_continuous_events (rn))
364
364
end
365
365
@@ -410,13 +410,13 @@ function get_continuous_events_annotation(rn::ReactionSystem)
410
410
end
411
411
412
412
# Combines the 3 -related functions in a constant tuple.
413
- CONTINUOUS_EVENTS_FS = (has_continuous_events , get_continuous_events_string, get_continuous_events_annotation)
413
+ CONTINUOUS_EVENTS_FS = (seri_has_continuous_events , get_continuous_events_string, get_continuous_events_annotation)
414
414
415
415
416
416
# ## Handles Discrete Events ###
417
417
418
- # Checks if the reaction system have any discrete events.
419
- function has_discrete_events (rn:: ReactionSystem )
418
+ # Checks if the reaction system has any discrete events.
419
+ function seri_has_discrete_events (rn:: ReactionSystem )
420
420
return ! isempty (MT. get_discrete_events (rn))
421
421
end
422
422
@@ -466,17 +466,17 @@ function get_discrete_events_annotation(rn::ReactionSystem)
466
466
end
467
467
468
468
# Combines the 3 -related functions in a constant tuple.
469
- DISCRETE_EVENTS_FS = (has_discrete_events , get_discrete_events_string, get_discrete_events_annotation)
469
+ DISCRETE_EVENTS_FS = (seri_has_discrete_events , get_discrete_events_string, get_discrete_events_annotation)
470
470
471
471
472
472
# ## Handles Systems ###
473
473
474
474
# Specific `push_field` function, which is used for the system field (where the annotation option
475
475
# must be passed to the `get_component_string` function). Since non-ReactionSystem systems cannot be
476
- # written to file, this functions throws an error if any such systems are encountered.
476
+ # written to file, this function throws an error if any such systems are encountered.
477
477
function push_systems_field (file_text:: String , rn:: ReactionSystem , annotate:: Bool , top_level:: Bool )
478
- # Checks whther there are any subsystems, and if these are ReactionSystems.
479
- has_systems (rn) || (return (file_text, false ))
478
+ # Checks whether there are any subsystems, and if these are ReactionSystems.
479
+ seri_has_systems (rn) || (return (file_text, false ))
480
480
if any (! (system isa ReactionSystem) for system in MT. get_systems (rn))
481
481
error (" Tries to write a ReactionSystem to file which have non-ReactionSystem subs-systems. This is currently not possible." )
482
482
end
@@ -489,8 +489,8 @@ function push_systems_field(file_text::String, rn::ReactionSystem, annotate::Boo
489
489
return (file_text * write_string, true )
490
490
end
491
491
492
- # Checks if the reaction system have any systems.
493
- function has_systems (rn:: ReactionSystem )
492
+ # Checks if the reaction system has any systems.
493
+ function seri_has_systems (rn:: ReactionSystem )
494
494
return ! isempty (MT. get_systems (rn))
495
495
end
496
496
@@ -519,13 +519,13 @@ function get_systems_annotation(rn::ReactionSystem)
519
519
end
520
520
521
521
# Combines the 3 systems-related functions in a constant tuple.
522
- SYSTEMS_FS = (has_systems , get_systems_string, get_systems_annotation)
522
+ SYSTEMS_FS = (seri_has_systems , get_systems_string, get_systems_annotation)
523
523
524
524
525
525
# ## Handles Connection Types ###
526
526
527
- # Checks if the reaction system have any connection types.
528
- function has_connection_type (rn:: ReactionSystem )
527
+ # Checks if the reaction system has any connection types.
528
+ function seri_has_connection_type (rn:: ReactionSystem )
529
529
return false
530
530
end
531
531
@@ -540,4 +540,4 @@ function get_connection_type_annotation(rn::ReactionSystem)
540
540
end
541
541
542
542
# Combines the 3 connection types-related functions in a constant tuple.
543
- CONNECTION_TYPE_FS = (has_connection_type , get_connection_type_string, get_connection_type_annotation)
543
+ CONNECTION_TYPE_FS = (seri_has_connection_type , get_connection_type_string, get_connection_type_annotation)
0 commit comments