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

com.bnorm.infinite.async.AsyncStateMachineFactory Maven / Gradle / Ivy

The newest version!
package com.bnorm.infinite.async;

import com.bnorm.infinite.StateMachineFactory;
import com.bnorm.infinite.StateMachineStructure;

/**
 * A factory interface for asynchronous state machines.
 *
 * @param  the class type of the states.
 * @param  the class type of the events.
 * @param  the class type of the context.
 * @author Brian Norman
 * @since 1.1.0
 */
public interface AsyncStateMachineFactory extends StateMachineFactory {

    /**
     * Returns the default asynchronous state machine factory.  This is the asynchronous state machine base
     * constructor.
     *
     * @param  the class type of the states.
     * @param  the class type of the events.
     * @param  the class type of the context.
     * @return default internal state factory.
     */
    static  AsyncStateMachineFactory getDefault() {
        return AsyncStateMachineBase::new;
    }


    /**
     * Creates an asynchronous state machine from the specified state machine structure, starting state, and context.
     *
     * @param structure the state machine structure.
     * @param starting the starting state of the state machine.
     * @param context the state machine context.
     * @return a state machine.
     */
    @Override
    AsyncStateMachine create(StateMachineStructure structure, S starting, C context);
}