public MetricsStateLoader( IStateLoader stateLoader, IClaptrapDesign claptrapDesign) { _stateLoader = stateLoader; _claptrapDesign = claptrapDesign; }
public AutoMigrationStateLoader( IStateLoader stateLoader, IStateLoaderMigration stateLoaderMigration) { _stateLoader = stateLoader; _migrated = new Lazy <Task>(stateLoaderMigration.MigrateAsync); }
public Crossword(MonochromeCell[,] gridData, IRules rules, IStateLoader loader, IMainGridBuilder mainGridBuilder, List <IHintsGridBuider> hintsBuilders, IAnnouncer announcer) { _rules = rules; _stateLoader = loader; _mainGridBuilder = mainGridBuilder; _announcer = announcer; ReloadHints(gridData); _hintsGridBuilders = hintsBuilders; BuildGame(gridData); }
/// <summary> /// Aggregates two states loaded by the state loader and saves the resulting aggregation using the target state /// persister. /// </summary> /// <param name="sourceA">The first state to load <see cref="IStateLoader"/></param> /// <param name="sourceB">The second state to load <see cref="IStateLoader"/></param> /// <param name="target">The target persister <see cref="IStatePersister"/></param> public void AggregateStateTo(IStateLoader sourceA, IStateLoader sourceB, IStatePersister target) { Option <S> maybeStateA = sourceA.Load <S>(new Option <IAnalyzer <IMetric> >((IAnalyzer <IMetric>) this)); Option <S> maybeStateB = sourceB.Load <S>(new Option <IAnalyzer <IMetric> >((IAnalyzer <IMetric>) this)); S aggregated = (maybeStateA.HasValue, maybeStateB.HasValue) switch { (true, true) => maybeStateA.Value.Sum(maybeStateB.Value), (true, false) => maybeStateA.Value, (false, true) => maybeStateB.Value, _ => null }; target.Persist(new Option <IAnalyzer <IMetric> >((IAnalyzer <IMetric>) this), new Option <S>(aggregated)); }
public StateRestorer( IClaptrapIdentity claptrapIdentity, EventLoadingOptions eventLoadingOptions, IStateAccessor stateAccessor, IInitialStateDataFactory initialStateDataFactory, IStateLoader stateLoader, IEventLoader eventLoader, IEventHandlerFactory eventHandlerFactory, IL l, ILogger <StateRestorer> logger) { _claptrapIdentity = claptrapIdentity; _eventLoadingOptions = eventLoadingOptions; _stateAccessor = stateAccessor; _initialStateDataFactory = initialStateDataFactory; _stateLoader = stateLoader; _eventLoader = eventLoader; _eventHandlerFactory = eventHandlerFactory; _l = l; _logger = logger; }
/// <summary> /// Copy the state from source to target. /// </summary> /// <param name="source">The <see cref="IStateLoader"/> to read from.</param> /// <param name="target">The <see cref="IStatePersister"/> to write to.</param> public void CopyStateTo(IStateLoader source, IStatePersister target) => target.Persist(new Option <IAnalyzer <IMetric> >((IAnalyzer <IMetric>) this), source.Load <S>(new Option <IAnalyzer <IMetric> >((IAnalyzer <IMetric>) this)));
/// <summary> /// Load the <see cref="State{T}"/> from a <see cref="IStateLoader"/> and compute the <see cref="Metric{T}"/> /// </summary> /// <param name="source">The <see cref="IStateLoader"/>.</param> /// <returns>Returns the computed <see cref="Metric{T}"/>.</returns> public M LoadStateAndComputeMetric(IStateLoader source) => ComputeMetricFrom(source.Load <S>(new Option <IAnalyzer <IMetric> >((IAnalyzer <IMetric>) this)));
/// <summary> /// Use to load saved analyzer states and aggregate them with those calculated in this new run. Can be used to efficiently compute metrics for a large dataset if e.g. a new partition is added. /// </summary> /// <param name="stateLoader">A state loader that loads previously calculated states and allows aggregation with the ones calculated in this run.</param> /// <returns></returns> public VerificationRunBuilder AggregateWith(IStateLoader stateLoader) { this.stateLoader = new Option <IStateLoader>(stateLoader); return(this); }
public MyStateLoader(IStateLoader stateLoader) : base(stateLoader) { }
protected AbstractSerializer(IStateLoader stateSaver) { StateSaver = stateSaver; }
private static FrequenciesAndNumRows FindStateForParticularGrouping(IEnumerable <IGroupingAnalyzer <IMetric> > analyzers, IStateLoader stateLoader) { /* One of the analyzers must have the state persisted */ IEnumerable <Option <FrequenciesAndNumRows> > states = analyzers.Select(analyzer => stateLoader.Load <FrequenciesAndNumRows>( (Analyzer <FrequenciesAndNumRows, IMetric>)analyzer)); return(states.FirstOrDefault().Value); }
public AuctionItemActorStateLoader(IStateLoader stateLoader) : base(stateLoader) { }
protected DecoratedStateLoader( IStateLoader stateLoader) { StateLoader = stateLoader; }
public XmlReader(IStateLoader stateLoader) : base(stateLoader) { }
public MetricsStateLoader( IStateLoader stateLoader) { _stateLoader = stateLoader; }
public BattleState(IViewBase viewBase, IStateLoader loader, ITimeSimulater simulater) { ViewBase = viewBase; Perception = new BattlePerception(this, viewBase.Create(simulater)); loader.Load(this); }