/// <summary> /// Gets then next block spec to execute /// </summary> /// <param name="currentBlock">The current block</param> /// <param name="target">The next target</param> /// <returns></returns> private StackBlockSpecBase <TInput, TState, TOperationEvent> GetNext(StackBlockSpecBase <TInput, TState, TOperationEvent> currentBlock, BlockResultTarget target) { switch (target.FlowTarget) { case BlockFlowTarget.Return: return(blocks.GetNext(currentBlock.Index)); case BlockFlowTarget.Goto: return(blocks.GetByTagOrIndex(target.TargetTag, target.TargetIndex)); case BlockFlowTarget.Retry: return(currentBlock); case BlockFlowTarget.Reset: return(blocks.GetFirst()); case BlockFlowTarget.Restart: return(blocks.GetFirst()); case BlockFlowTarget.Skip: return(blocks.SkipBy(currentBlock.Index, target.TargetIndex)); case BlockFlowTarget.Complete: case BlockFlowTarget.Fail: return(blocks.GotoEnd(currentBlock.Index)); default: return(null); } }
public OperationStackExecutionState(OperationStackOptions options, StackBlocks <TInput, TState, TOperationEvent> blocks, TInput stackInput, TState initialState) { this.options = options; this.blocks = blocks; StackInput = stackInput; CurrentBlockSpec = blocks.GetFirst(); this.InitialState = initialState; State = initialState; }