This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class StateMachine<T, E>( | |
private val dispatcher: Dispatcher, | |
private val errorFactory: ErrorFactory<E>, | |
protected var currentState: State<T, E> = State(State.Name.IDLE), | |
private val listeners: MutableList<StateListener<T, E>> = mutableListOf() | |
) { | |
abstract fun start() | |
fun addStateChangedListener(listener: StateListener<T, E>) { | |
this.listeners.add(listener) |