示例#1
0
 public static IStateMachineProvider <TContext, int, TStraightforwardStatefulTask> PerformUntilFinalState <TContext, TStraightforwardStatefulTask>(
     this IStraightforwardStateMachineBuilder <TContext, TStraightforwardStatefulTask> builder,
     TContext context,
     CustomStateMachineAction <int>?customAction)
     where TStraightforwardStatefulTask : class, IStraightforwardStatefulTask <TContext>
 {
     return(StraightforwardStateMachineProvider.Create(
                context, builder.InitialTask, builder.TransitionsList, customAction
                ));
 }
示例#2
0
 public static IStateMachineProvider <TContext, TStateId, TStatefulTask> PerformUntilFinalState <TContext, TStateId, TStatefulTask>(
     this IStateMachineBuilderWithoutStateId <TContext, TStateId, TStatefulTask> builder,
     TContext context,
     CustomStateMachineAction <TStateId>?customAction)
     where TStatefulTask : class, IStatefulTask <TContext, TStateId>
 {
     return(StateMachineUntilFinalStateProvider.Create(
                context, builder.InitialTask, builder.TransitionsTable, customAction
                ));
 }
 public StateMachineUntilFinalStateProvider(
     TContext context,
     TStatefulTask initialTask,
     IReadOnlyDictionary <TStateId, TStatefulTask> transitionsTable,
     CustomStateMachineAction <TStateId>?customAction)
 {
     _context          = context;
     _initialTask      = initialTask.ThrowIfNull(nameof(initialTask));
     _transitionsTable = transitionsTable.ThrowIfNull(nameof(transitionsTable));
     _customAction     = customAction ?? (doAction => doAction());
 }
 public StraightforwardStateMachineProvider(
     TContext context,
     TStraightforwardStatefulTask initialTask,
     IReadOnlyList <TStraightforwardStatefulTask> transitionsList,
     CustomStateMachineAction <int>?customAction)
 {
     _context         = context;
     _initialTask     = initialTask.ThrowIfNull(nameof(initialTask));
     _transitionsList = transitionsList.ThrowIfNull(nameof(transitionsList));
     _customAction    = customAction ?? (doAction => doAction());
 }
 public StateMachineUntilFinalStateEnumerator(
     TContext context,
     TStatefulTask initialTask,
     IReadOnlyDictionary <TStateId, TStatefulTask> transitionsTable,
     CustomStateMachineAction <TStateId> customAction)
 {
     Context           = context;
     _current          = initialTask.ThrowIfNull(nameof(initialTask));
     _transitionsTable = transitionsTable.ThrowIfNull(nameof(transitionsTable));
     _customAction     = customAction.ThrowIfNull(nameof(customAction));
 }
        public StraightforwardStateMachineEnumerator(
            TContext context,
            TStraightforwardStatefulTask initialTask,
            IReadOnlyList <TStraightforwardStatefulTask> transitionsList,
            CustomStateMachineAction <int> customAction)
        {
            Context          = context;
            _current         = initialTask.ThrowIfNull(nameof(initialTask));
            _transitionsList = transitionsList.ThrowIfNull(nameof(transitionsList));
            _customAction    = customAction.ThrowIfNull(nameof(customAction));

            _currentStateId = 0;
        }