public Appl(IStrategyFactory strategyFactory, IStrategySelector strategySelector, IWorldSource worldSource) { _strategyFactory = strategyFactory; _strategySelector = strategySelector; _worldSource = worldSource; }
public TicketService(ITicketRepository tickRepo, IReservationRepository resRepo, IStrategyFactory strategyFactory, IRunRepository runRepository) { _tickRepo = tickRepo; _resRepo = resRepo; _strategyFactory = strategyFactory; _runRepository = runRepository; }
private void FormStrategy_Load(object sender, EventArgs e) { _Factory = StrategyFactoryCreater.Instance().CreateFactory(StrategyFactoryType.Normal); foreach (string val in _Factory.AllStrategyNames) { checkedListBoxStrategy.Items.Add(val, CheckState.Checked); } }
private const double INITCASH = 100000; // 初始化的账户金额 public void Go(IStockHistory history, IStrategyFactory strategies) { History_ = history; foreach (IFinanceStrategy strategy in strategies.AllStrategies) { ExecTask(strategy); } }
public void Go(IStockHistory history, IStrategyFactory strategies) { History_ = history; foreach (IFinanceStrategy strategy in strategies.AllStrategies) { ExecTask(strategy); } }
public BetStrategyService(IGameRepository gameRepository, IBetRepository betRepository, IStrategyRepository strategyRepository, IStrategyFactory strategyFactory,IRankingRepository rankingRepository, IScorer scorer) { this._gameRepository = gameRepository; this._betRepository = betRepository; this._strategyRepository = strategyRepository; this._strategyFactory = strategyFactory; this._rankingRepository = rankingRepository; this._scorer = scorer; }
public BetStrategyService(IGameRepository gameRepository, IBetRepository betRepository, IStrategyRepository strategyRepository, IStrategyFactory strategyFactory, IRankingRepository rankingRepository, IScorer scorer) { this._gameRepository = gameRepository; this._betRepository = betRepository; this._strategyRepository = strategyRepository; this._strategyFactory = strategyFactory; this._rankingRepository = rankingRepository; this._scorer = scorer; }
void TestFactory(StrategyFactoryType tp) { ScoresCalculator calc = new ScoresCalculator(); IStrategyFactory factory = StrategyFactoryCreater.Instance().CreateFactory(tp); FakeStockHistory fsh = new FakeStockHistory(); fsh.Init(); calc.Calc(fsh, factory, new FakeIBonusProcessor()); }
/// <summary> /// Calculate score of each strategy /// </summary> /// <param name="history">One stock history</param> /// <param name="factory">Strategy Factory</param> /// <param name="reader">Bonus imformation</param> public void Calc(IStockHistory history, IStrategyFactory factory, IBonusProcessor reader) { FinanceRunner runner = new FinanceRunner(); runner.CurrentBonusProcessor = reader; runner.Go(history, factory); IStrategyJudger judger = new StrategyJudger(); judger.Judge(runner.Results); IStrategyJudger judger2 = new ValidationJudger(); judger2.Judge(runner.Results); AllScores_.AddRange(judger.ScoresArr); AllScores_.AddRange(judger2.ScoresArr); }
public RunController(ITicketRepository tick, IRunRepository run, IReservationService resServ, ITicketService tickServ, IStrategyFactory strategyFactory, IReservationRepository reservationRepo, ITrainRepository trainRepo) { _tickRepo = tick; _runRepo = run; _resServ = resServ; _tickServ = tickServ; _strategyFactory = strategyFactory; _reservationRepo = reservationRepo; _trainRepo = trainRepo; }
private void RunStrategy() { SetUserDefinedDate(); log_.Info("==>AutoCompare start. Start Date = " + History_.MinDate.ToLongDateString() + ", End Date = " + History_.MaxDate.ToLongDateString()); if (History_.MinDate >= History_.MaxDate) { log_.Error("Stock histroy not correct!"); return; } IStrategyFactory factory = StrategyFactoryCreater.Instance().CreateFactory(StrategyFactoryType.Normal); ScoresCalculator calc = new ScoresCalculator(); calc.Calc(History_, factory, BonusProcessor_); calc.ShowResult(); }
public void Go() { FakeStockHistory hist = new FakeStockHistory(); hist.Init(); LogMgr.Logger = new DummyLog(); FinanceRunner runner = new FinanceRunner(); runner.CurrentBonusProcessor = new FakeIBonusProcessor(); IStrategyFactory factory = StrategyFactoryCreater.Instance().CreateFactory(StrategyFactoryType.Normal); runner.Go(hist, factory); StrategyResults results = runner.Results; Assert.IsTrue(results.AllStrategyNames.Count > 0); LogMgr.Logger.Close(); }
public Task Invoke(HttpContext httpContext, IActor actor, StoreHolder holder, IStrategyFactory factory) { using (var session = holder.Store.OpenSession()) { actor.System = LoadSystem(session); actor.Me = LoadMe(httpContext, session); if (actor.HasSystemRole(SystemRoles.ContentManager) || actor.HasSystemRole(SystemRoles.ConventionManager) || actor.HasSystemRole(SystemRoles.ReceptionManager) || actor.HasSystemRole(SystemRoles.UsersManager)) { actor.ManagedConvention = LoadConvention(actor.System.ManagersConventionId, session); if (actor.ManagedConvention != null) { actor.ManagedDropDowns = LoadDropDowns(factory, actor.ManagedConvention, actor.System); } } if (actor.ManagedConvention != null && actor.System.DisplayConventionId == actor.System.ManagersConventionId) { actor.DisplayConvention = actor.ManagedConvention; actor.DisplayDropDowns = actor.ManagedDropDowns; } else { actor.DisplayConvention = LoadConvention(actor.System.DisplayConventionId, session); if (actor.DisplayConvention != null) { actor.DisplayDropDowns = LoadDropDowns(factory, actor.DisplayConvention, actor.System); } } } return(_next(httpContext)); }
/// <summary> /// Calculates all relevant data and puts them in a container /// </summary> /// <param name="startLevel">The start level.</param> /// <param name="targetLevel">The target level.</param> /// <param name="gainedExpPercentage">The gained exp percentage.</param> /// <param name="startBossStage">The start boss stage.</param> /// <param name="endBossStage">The end boss stage.</param> /// <param name="isClanArena">if set to <c>true</c> [is clan arena].</param> /// <param name="isBaium">if set to <c>true</c> [is baium].</param> /// <param name="isZaken">if set to <c>true</c> [is zaken].</param> /// <param name="isAntharas">if set to <c>true</c> [is antharas].</param> /// <param name="isDailyQuest">if set to <c>true</c> [is DailyQuest].</param> /// <param name="instanceEntranceFee">The instance entrance fee.</param> /// <param name="strategyFactory">The strategyFactory. For unit testing purposes</param> /// <returns>returns data container if arguments are valid. Otherwise returns light weight container with total experience only</returns> public ILevelingContainer CalculateExping( int startLevel, int targetLevel, double gainedExpPercentage, int startBossStage, int endBossStage, bool isClanArena = false, bool isBaium = false, bool isZaken = false, bool isAntharas = false, bool isDailyQuest = false, int instanceEntranceFee = 0, IStrategyFactory strategyFactory = null) { if (startLevel > targetLevel) { return(null); } var factory = strategyFactory ?? new StrategyFactory(); IReadOnlyCollection <IStrategy> strategies = factory.CreateStrategies( isClanArena, isBaium, isAntharas, isZaken, isDailyQuest, startBossStage, endBossStage); ulong totalExperience = CalculateTotalExp(startLevel, targetLevel, gainedExpPercentage); if (strategies.Count == 0) { return(new LevelingContainer(totalExperience, startLevel)); } var container = new LevelingContainer(totalExperience, startLevel); return(ApplyStrategies( strategies, container)); }
private void RunStrategyOnMultiStocks() { // Load from DB IEnumerable <int> allStockId = new List <int> { 600238, 600239, 600240, 600007, 600008, 600009, 600010, 600019, 600020, 600021, 600022 }; StocksHistory histories = new StocksHistory(); histories.Load(allStockId); IStrategyFactory factory = StrategyFactoryCreater.Instance().CreateFactory(StrategyFactoryType.Normal); ScoresCalculator calc = new ScoresCalculator(); foreach (IStockHistory hist in histories.GetAllHistories()) { calc.Calc(hist, factory, null); } calc.ShowResult(); }
public GameSetter(IConfigurationSetter languageSet, ISecondaryInputProvider inputProvider, IPlayerFactory playerFactory, IStrategyFactory strategyFactory) { if (languageSet == null || playerFactory == null || strategyFactory == null || inputProvider == null) { throw new NullReferenceException(nameof(GameSetter)); } LanguageSet = languageSet; PlayerFactory = playerFactory; StrategyFactory = strategyFactory; InputProvider = inputProvider; GameType = inputProvider.ReturnTypeOfGame(); if (GameType == 1) { CreatePlayersFor36CardGame(); } if (GameType == 2) { CreatePlayersFor54CardGame(); } }
public ActorDropDowns(IStrategyFactory factory, ActorConventionState convention, ActorSystemState system) { _convention = convention; _system = system; _factory = factory; }
public IProcess Create(IStrategyFactory strategyFactory, List <IPageReference> clone) { throw new System.NotImplementedException(); }
public StrategyEngine(IStrategyFactory strategyFactory) { _strategyFactory = strategyFactory; }
public MyController(IStrategyFactory factory) { _factory = factory; }
public BergerPairing(IStrategyFactory strategyFactory, int singleRounds) { _strategyFactory = strategyFactory; SingleRounds = singleRounds; }
public void Setup() { _factory = new StrategyFactory(); _sessionFactory = new SessionFactory(new MsSql2008CustomConfiguration()); }
public PrimitiveCalculator(IStrategy strategy, IStrategyFactory strategyFactory) { this.Strategy = strategy; this.StrategyFactory = strategyFactory; }
public GildedRoseStore(IStrategyFactory strategyFactory) { _strategyFactory = strategyFactory; }
public Process(IStrategyFactory strategyFactory, List <IPageReference> pageReferenceList) { PageReferenceList = pageReferenceList; Strategy = strategyFactory.Create(this); _pagesToLoad = GetPagesEnumerable().GetEnumerator(); }
public ValuesController(IStrategyFactory strategyFactory) { _strategyFactory = strategyFactory; }
private Actor.ActorDropDowns LoadDropDowns(IStrategyFactory factory, Actor.ActorConventionState convention, Actor.ActorSystemState system) { return(new Actor.ActorDropDowns(factory, convention, system)); }
public GameRunner(IGame <GameState> game, IUserInterface ui, IStrategyFactory strategyFactory) { _game = game; _ui = ui; _strategyFactory = strategyFactory; }