Common state machine for multi platform


#1

I am planning on refactoring base code. Part of the refactoring is leveraging the Kotlin multiplatform capabilities.
I need a common library for implementing many kinds of state machines (Concurrent / Hierarchical).
I could not find a common library for a state machine.
I thought about these options:

  1. Convert a Java library to Kotlin and make it common
  2. Convert a native state machine to common Kotlin
  3. Write interfaces for accessing state machine and implement/use state machine per platform from a common code
  4. Write a common Kotlin state machine framework from scratch

Is anyone familiar with a common state machine library? what is the best option?

Thanks,
Igal