本文整理汇总了C#中IStrategy类的典型用法代码示例。如果您正苦于以下问题:C# IStrategy类的具体用法?C# IStrategy怎么用?C# IStrategy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IStrategy类属于命名空间,在下文中一共展示了IStrategy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PerformSimulation
public SeasonSimulationResult PerformSimulation(IStrategy strategy, SeasonSimulationOptions options)
{
if (strategy == null) throw new ArgumentNullException("strategy");
var allPlayers = GetPlayersForFirstGameweek();
var maxGameweek = CalculateMaxGameweek(options.MaximumGameweek);
_logger.Log(Tag.Simulation, string.Concat("Max gameweek is ", maxGameweek));
var startingTeam = options.UseSavedInitialTeam ? SelectInitialTeamByIds(allPlayers, options.InitialTeamPlayerIds) : strategy.PickStartingTeam(allPlayers);
_logger.Log(Tag.Simulation, "Starting team picked");
LogHelper.LogTeam(startingTeam, _logger);
if (options.ChooseInitialTeamOnly)
{
return new SeasonSimulationResult();
}
var seasonState = _decisionActioner.ValidateAndApplyStartingTeam(startingTeam, allPlayers);
_logger.Log(Tag.Simulation, "Applied starting team");
return SimulateSeason(seasonState, strategy, maxGameweek);
}
示例2: QuoteProvider
public QuoteProvider(IStrategy owner)
{
_owner = owner;
_lastPeek = new DateTime(1900, 1, 1);
_timer = new Timer(1000);
_timer.Elapsed += new ElapsedEventHandler(OnTick);
}
示例3: run
public void run()
{
try
{
remoteProcessClient.WriteToken(token);
int teamSize = remoteProcessClient.ReadTeamSize();
remoteProcessClient.WriteProtocolVersion();
Game game = remoteProcessClient.readGameContext();
IStrategy[] strategies = new IStrategy[teamSize];
for (int strategyIndex = 0; strategyIndex < teamSize; ++strategyIndex)
{
strategies[strategyIndex] = new MyStrategy();
}
PlayerContext playerContext;
while ((playerContext = remoteProcessClient.ReadPlayerContext()) != null)
{
Trooper playerTrooper = playerContext.Trooper;
Move move = new Move();
strategies[playerTrooper.TeammateIndex].Move(playerTrooper, playerContext.World, game, move);
remoteProcessClient.WriteMove(move);
}
}
finally
{
remoteProcessClient.Close();
}
}
示例4: AddStock
/// <summary>
/// 增加一个策略,和关注的股票价格
/// </summary>
/// <param name="code">股票代码</param>
/// <param name="strategy">策略实例</param>
public void AddStock(String code, IStrategy strategy)
{
if (stockDataCache[code] == null)
{
stockDataCache[code] = new StockDataQueue();
}
stockDataCache[code].OnStockDataChange += strategy.OnStockDataChanged;
}
示例5: Template
public Template(IStrategy strategy, String templateText, String[] namespaces,
params Variable[] variables)
{
_strategy = strategy;
this.templateText = templateText;
this.namespaces = namespaces;
this.variables = variables;
}
示例6: StrategyControl
public StrategyControl(IStrategy strategy)
{
InitializeComponent();
this.strategy = strategy;
// load my stock pool
LoadMyStockPool();
}
示例7: BuildConfigurationContext
public ConfigurationContext BuildConfigurationContext(BaseFeature feature, IStrategy strategy)
{
if (string.IsNullOrWhiteSpace(Key))
{
throw new ArgumentException("Missing 'Key' parameter for '" + strategy.GetType().Name + "' strategy for '" + feature.Name + "' feature");
}
return new ConfigurationContext(this);
}
示例8: ComplexStrategy
public ComplexStrategy(IStrategy[] innerStrategies, string name, long quantity,
IStrategy defaultStrategy, StrategyType strategyType)
{
_innerStrategies = innerStrategies;
_name = name;
_quantity = quantity;
_defaultStrategy = defaultStrategy;
_strategyType = strategyType;
}
示例9: GuardianAgentSession
public GuardianAgentSession(Agent agent, string process,
IStrategy redStrategy, IStrategy yellowStrategy, double e1, double e2)
{
this.Agent = agent;
this.TargetProcess = process;
this.RedStrategy = redStrategy;
this.YellowStrategy = yellowStrategy;
this.E1 = e1;
this.E2 = e2;
}
示例10: ReachabilityStrategyCalculationAlgorithm
public ReachabilityStrategyCalculationAlgorithm(ITestGraph testGraph, IStrategy strategy)
{
if (this.testGraph == null)
{
throw new ArgumentNullException("testGraph");
}
this.testGraph = testGraph;
this.strategy = new QuickGraph.Algorithms.TestGames.Strategy();
this.performanceComparer = new PairPreOrderPerformanceComparer();
}
开发者ID:NigelThorne,项目名称:ndependencyinjection,代码行数:10,代码来源:ReachabilityStrategyCalculationAlgorithm.cs
示例11: FoxWatchMainController
public FoxWatchMainController(IStrategy strategy, DBOutEnum dbOutEnum)
{
_strategy = strategy;
Boolean bDBOut_InRunning = false;
if (dbOutEnum == DBOutEnum.Enable)
{
bDBOut_InRunning = true;
}
_foxCaptureController = new FoxWatchCaptureController(bDBOut_InRunning);
}
示例12: RecognizedAgent
public RecognizedAgent(string name, double res,
IStrategy redStrategy, IStrategy yellowStrategy,
double p1, double p2)
{
Name = name;
m_P1 = p1;
m_P2 = p2;
m_Res = res;
m_RedStrategy = redStrategy;
m_YellowStrategy = yellowStrategy;
}
示例13: RegisterStrategy
/// <summary>
/// 在行情市场中登记一个策略,当关注股票价格发生变动的时候,即时提醒策略。
/// </summary>
/// <param name="strategy">策略实例</param>
public void RegisterStrategy(IStrategy strategy)
{
foreach (string code in strategy.StockPool)
{
if (!StockMarketManager.bidCache.ContainsKey(code))
{
StockMarketManager.bidCache.Add(code, new BidCacheQueue());
}
StockMarketManager.bidCache[code].OnBidChange += strategy.OnStockDataChanged;
}
}
示例14: ProcessStrategy
private void ProcessStrategy(IStrategy strategy)
{
foreach (var quote in this.quotes)
{
strategy.ProcessQuote(quote);
}
if (Interlocked.Decrement(ref numberOfTasks) == 0)
{
signal.Set();
}
}
示例15: SwitchStrategy
// Changing strategies
public void SwitchStrategy()
{
if (strategy is Strategy1)
strategy = new Strategy2();
else
strategy = new Strategy1();
}