public static ISimpleStateMachine <TMachineState, TMachineEvent> CreateSimple <TMachineState, TMachineEvent>( TMachineState initialState, IStateMachineConfiguration <TMachineState, TMachineEvent> configuration) { if (configuration is StateMachineDispatcher <TMachineState, TMachineEvent> dispatcher) { var machine = new SimpleStateMachine <TMachineState, TMachineEvent>(initialState, dispatcher); return(machine); } throw new ArgumentException("configuration must not be a custom implementation of the state machine configuration interface."); }
public static IEventStateMachine <TMachineState, TMachineEvent, TGeneratedEvent> CreateEvent <TMachineState, TMachineEvent, TGeneratedEvent>( TMachineState initialState, IStateMachineConfiguration <TMachineState, TMachineEvent, TGeneratedEvent> configuration) { if (configuration is EventStateMachine.Dispatch.StateMachineDispatcher <TMachineState, TMachineEvent, TGeneratedEvent> dispatcher) { var synchronizationQueueFactory = new DataFlowSynchronizationQueueFactory(); var machine = new EventStateMachine <TMachineState, TMachineEvent, TGeneratedEvent>(initialState, dispatcher, synchronizationQueueFactory); return(machine); } throw new ArgumentException("configuration must not be a custom implementation of the state machine configuration interface."); }