All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.ru.kontur.mobile.visualfsm.TransitionCallbacks.kt Maven / Gradle / Ivy

package ru.kontur.mobile.visualfsm

/**
 * Inherit to declare third party logic on provided event calls (like logging, debugging, or metrics)
 */
interface TransitionCallbacks {

    /**
     * Is called when [Action] is being launched
     *
     * @param action [Action] that is being launched
     * @param currentState current [state][STATE]
     */
    fun onActionLaunched(
        action: Action,
        currentState: STATE
    )

    /**
     * Is called on transition being selected
     *
     * @param action [Action] that is being launched
     * @param transition selected [transition][Transition]
     * @param currentState current [state][STATE]
     */
    fun onTransitionSelected(
        action: Action,
        transition: Transition,
        currentState: STATE
    )

    /**
     * Is called when [new state][State] reduced
     *
     * @param action [Action] that is being launched
     * @param transition selected [transition][Transition]
     * @param oldState current [state][STATE]
     * @param newState new [state][State]
     */
    fun onNewStateReduced(
        action: Action,
        transition: Transition,
        oldState: STATE,
        newState: STATE
    )

    /**
     * Is called when there is no available [transition][Transition]
     *
     * @param action [Action] that was being launched
     * @param currentState current [state][State]
     */
    fun onNoTransitionError(
        action: Action,
        currentState: STATE
    )

    /**
     * Is called when more than one [transition][Transition] is available
     *
     * @param action [Action] that was being launched
     * @param currentState current [state][State]
     */
    fun onMultipleTransitionError(
        action: Action,
        currentState: STATE
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy