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

io.github.yangziwen.quickstate.builder.StateMachineBuilder Maven / Gradle / Ivy

There is a newer version: 0.0.5
Show newest version
package io.github.yangziwen.quickstate.builder;

import java.util.Map;

import io.github.yangziwen.quickstate.State;
import io.github.yangziwen.quickstate.StateMachine;
import io.github.yangziwen.quickstate.StateMachineFactory;
import io.github.yangziwen.quickstate.TransitionType;
import io.github.yangziwen.quickstate.impl.TransitionBuilderImpl;

public interface StateMachineBuilder> {

    default ExternalTransitionBuilder externalTransition() {
        return new TransitionBuilderImpl<>(getStateMap(), TransitionType.EXTERNAL);
    }

    default InternalTransitionBuilder internalTransition() {
        return new TransitionBuilderImpl<>(getStateMap(), TransitionType.INTERNAL);
    }

    default M build(String machineId) {
        M stateMachine = newStateMachine(machineId, getStateMap());
        StateMachineFactory.register(stateMachine);
        return stateMachine;
    }

    M newStateMachine(String machineId, Map> stateMap);

    Map> getStateMap();

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy