|
1 | | -struct SymbolCache{S,T,U} |
| 1 | +struct SymbolCache{S, T, U} |
2 | 2 | syms::S |
3 | 3 | indepsym::T |
4 | 4 | paramsyms::U |
5 | 5 | end |
6 | 6 |
|
7 | | - |
8 | 7 | independent_variables(sc::SymbolCache) = sc.indepsym |
9 | | -independent_variables(::SymbolCache{S,Nothing}) where {S} = [] |
| 8 | +independent_variables(::SymbolCache{S, Nothing}) where {S} = [] |
10 | 9 | is_indep_sum(::Any, _) = false |
11 | 10 | is_indep_sym(sc::SymbolCache, sym) = any(isequal(sym), sc.indepsym) |
12 | | -is_indep_sym(::SymbolCache{S,Nothing}, _) where {S} = false |
| 11 | +is_indep_sym(::SymbolCache{S, Nothing}, _) where {S} = false |
13 | 12 | states(sc::SymbolCache) = sc.syms |
14 | 13 | states(::SymbolCache{Nothing}) = [] |
15 | 14 | state_sym_to_index(sc::SymbolCache, sym) = findfirst(isequal(sym), sc.syms) |
16 | 15 | state_sym_to_index(::SymbolCache{Nothing}, _) = nothing |
17 | 16 | is_state_sym(::Any, _) = false |
18 | 17 | is_state_sym(sc::SymbolCache, sym) = !isnothing(state_sym_to_index(sc, sym)) |
19 | 18 | parameters(sc::SymbolCache) = sc.paramsyms |
20 | | -parameters(::SymbolCache{S,T,Nothing}) where {S,T} = [] |
| 19 | +parameters(::SymbolCache{S, T, Nothing}) where {S, T} = [] |
21 | 20 | param_sym_to_index(sc::SymbolCache, sym) = findfirst(isequal(sym), sc.paramsyms) |
22 | | -param_sym_to_index(::SymbolCache{S,T,Nothing}, _) where {S,T} = nothing |
| 21 | +param_sym_to_index(::SymbolCache{S, T, Nothing}, _) where {S, T} = nothing |
23 | 22 | is_param_sym(::Any, _) = false |
24 | 23 | is_param_sym(sc::SymbolCache, sym) = !isnothing(param_sym_to_index(sc, sym)) |
25 | | - |
26 | | -Base.copy(VA::SymbolCache) = typeof(VA)( |
27 | | - (VA.syms===nothing) ? nothing : copy(VA.syms), |
28 | | - (VA.indepsym===nothing) ? nothing : copy(VA.indepsym), |
29 | | - (VA.paramsyms===nothing) ? nothing : copy(VA.paramsyms), |
30 | | -) |
| 24 | + |
| 25 | +function Base.copy(VA::SymbolCache) |
| 26 | + typeof(VA)((VA.syms === nothing) ? nothing : copy(VA.syms), |
| 27 | + (VA.indepsym === nothing) ? nothing : copy(VA.indepsym), |
| 28 | + (VA.paramsyms === nothing) ? nothing : copy(VA.paramsyms)) |
| 29 | +end |
0 commit comments