MiloszKrajewski / stateful4k

State Machine Construction Kit for Kotlin
BSD 3-Clause "New" or "Revised" License
33 stars 0 forks source link

State machine of state machines #1

Open mohsenoid opened 6 years ago

mohsenoid commented 6 years ago

I was testing your cool library to use in my project which is fully written in Kotlin, and my question is what is the best implementation of having a main state machine which dispatch system control to other state machines and get control back and dispatch it to another one?

To be more specific, in my Android application I have different parts that my core(which would be the main state machine) can pass control to them and every one of them are another separate state machines which can give back control to the core.

I try to have different executor with same configurator but I am not sure if it is correct or not, however this way my configurator should include all my different state machines states and events!!

MiloszKrajewski commented 6 years ago

I'm not sure if I understand what you are trying to do. I can imagine switchable bevaviour implementated with "currentExecutor" as a field in main state machine and redirecting all evens from main machine into "currentExecutor" not worrying what it actually is. You can implement some special states in sub machines which may indicate that current executor should be switched to something else.

I'm not really sure exactly what you want to do though.

mohsenoid commented 6 years ago

Because of my application complexity if I am going to implement all my states in a single state machine it would get really complicated and hard to maintain. I was thinking for having separate FSM and passing execution between them, but had no idea if is it possible with your library and how?