Skip to content

Commit

Permalink
Move StateKind trait to BifurcationsBase
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Jun 20, 2018
1 parent 0a124e3 commit 77d9a7b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
3 changes: 3 additions & 0 deletions src/Bifurcations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ include("base/base.jl")
# TimeKind trait:
using .BifurcationsBase: timekind, Continuous, Discrete
import .BifurcationsBase: TimeKind
# StateKind trait:
using .BifurcationsBase: statekind, MutableState, ImmutableState
import .BifurcationsBase: StateKind

include("codim1/codim1.jl")

Expand Down
1 change: 1 addition & 0 deletions src/base/base.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module BifurcationsBase
include("timekind.jl")
include("statekind.jl")
end # module
6 changes: 6 additions & 0 deletions src/base/statekind.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
abstract type StateKind end
struct MutableState <: StateKind end
struct ImmutableState <: StateKind end

statekind(::T) where T = StateKind(T)
# TODO: Use StateKind everywhere instead of boolean iip type parameter.
9 changes: 0 additions & 9 deletions src/diffeq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@ using Setfield: Lens, set, get
const DEP{iip} = AbstractODEProblem{uType, tType, iip} where {uType, tType}


abstract type StateKind end
struct MutableState <: StateKind end
struct ImmutableState <: StateKind end

statekind(::T) where T = StateKind(T)
# TODO: Move StateKind to continuations/base.jl and use it everywhere.
# It's only used in here at the moment.


TimeKind(::Type{<: DiscreteProblem}) = Discrete()
TimeKind(::Type{<: AbstractODEProblem}) = Continuous()
StateKind(::Type{<: DEP{true}}) = MutableState()
Expand Down

0 comments on commit 77d9a7b

Please sign in to comment.