public Task ActivateAsync(IStateHolder <T> stateHolder) { Guard.NotNull(stateHolder, nameof(stateHolder)); this.stateHolder = stateHolder; return(ReadStateAsync()); }
public AliveNeighborsCount CountAliveNeighbors(IStateHolder stateHolder) { var neighborsStates = new List<CellState> { stateHolder.GetState(TopLeft()), stateHolder.GetState(Top()), stateHolder.GetState(TopRight()), stateHolder.GetState(Left()), stateHolder.GetState(Right()), stateHolder.GetState(BottomLeft()), stateHolder.GetState(Bottom()), stateHolder.GetState(BottomRight()), }; var aliveOnes = neighborsStates.Where(s => s.Equals(new Alive())); return new AliveNeighborsCount(aliveOnes.Count()); }
public MinionEventHandlerFLow(IStateAccessor stateAccessor, IStateHolder stateHolder, IEventHandlerFactory eventHandlerFactory, IStateRestorer stateRestorer, IStateSavingFlow stateSavingFlow, StateRecoveryOptions stateRecoveryOptions, EventLoadingOptions eventLoadingOptions, IEventLoader eventLoader, ILogger <MinionEventHandlerFLow> logger) : base(stateAccessor, stateHolder, eventHandlerFactory, stateRestorer, stateSavingFlow, stateRecoveryOptions, logger) { _eventLoadingOptions = eventLoadingOptions; _eventLoader = eventLoader; }
public MasterEventHandlerFLow(IStateAccessor stateAccessor, IStateHolder stateHolder, IEventHandlerFactory eventHandlerFactory, IStateRestorer stateRestorer, IStateSavingFlow stateSavingFlow, StateRecoveryOptions stateRecoveryOptions, IEventSaver eventSaver, IEventHandledNotificationFlow eventHandledNotificationFlow, ILogger <MasterEventHandlerFLow> logger) : base(stateAccessor, stateHolder, eventHandlerFactory, stateRestorer, stateSavingFlow, stateRecoveryOptions, logger) { _eventSaver = eventSaver; _eventHandledNotificationFlow = eventHandledNotificationFlow; _logger = logger; }
public ObjectHolder(T obj, IStateHolder <TState> stateHolder) { this.obj = obj; activationTask = obj.ActivateAsync(stateHolder); }
public static void Initialize(ISessionProvider sessionProvider, IStateHolder stateHolder) { _sessionProvider = sessionProvider; _stateHolder = stateHolder; }