Graph
class Graph<S : State, A : Action, E : Effect>(val edges: Map<KClass<S>, Map<KClass<A>, (prev: S, action: A) -> Transition<S, E>>>)
A graph that represents the state machine.
example:
val graph = Graph<State, Action, Effect> {
state<InitialState> {
action<InitialAction> { prev, action ->
transition(NextState, NextEffect)
}
action<AnotherAction> { prev, action ->
transition(AnotherState)
}
}
}
Content copied to clipboard