public NewIdGenerator(ITickProvider tickProvider, IWorkerIdProvider workerIdProvider, int workerIndex = 0) { _workerIndex = workerIndex; _workerId = workerIdProvider.GetWorkerId(_workerIndex); _tickProvider = tickProvider; _c = _workerId[0] << 24 | _workerId[1] << 16 | _workerId[2] << 8 | _workerId[3]; _d = _workerId[4] << 24 | _workerId[5] << 16; }
public NewIdGenerator(ITickProvider tickProvider, IWorkerIdProvider workerIdProvider, int workerIndex = 0) { _tickProvider = tickProvider; byte[] workerId = workerIdProvider.GetWorkerId(workerIndex); _c = workerId[0] << 24 | workerId[1] << 16 | workerId[2] << 8 | workerId[3]; _d = workerId[4] << 24 | workerId[5] << 16; }
public void Init() { _start = DateTime.UtcNow; _stopwatch = Stopwatch.StartNew(); _tickProvider = new MockTickProvider(GetTicks()); _workerIdProvider = new MockNetworkProvider(BitConverter.GetBytes(1234567890L)); _processIdProvider = new MockProcessIdProvider(BitConverter.GetBytes(10)); }
public NewIdGenerator(ITickProvider tickProvider, IWorkerIdProvider workerIdProvider, int workerIndex = 0) { _workerIndex = workerIndex; _workerId = workerIdProvider.GetWorkerId(_workerIndex); _tickProvider = tickProvider; _c = _workerId[0] << 24 | _workerId[1] << 16 | _workerId[2] << 8 | _workerId[3]; _d = _workerId[4] << 24 | _workerId[5] << 16; }
/// <summary> /// Creates a new commander with the given team and tick provider. /// </summary> /// <param name="teamID">Controls how this AI's units attack other units.</param> /// <param name="tickProvider">Provides the tick implementation for tick routines.</param> public SimpleAICommander(byte teamID, ITickProvider tickProvider) : base(teamID) { // Subscribe thought to tick. this.tickProvider = tickProvider; tickProvider.Tick += AIThoughtTick; // Set default values. thoughtCounter = 0f; thoughtInterval = 1f; // Listen to stop ticking. AllBasesDefeated += OnAllBasesDefeated; }
public NewIdGenerator(ITickProvider tickProvider, IWorkerIdProvider workerIdProvider, IProcessIdProvider processIdProvider = null, int workerIndex = 0) { _tickProvider = tickProvider; byte[] workerId = workerIdProvider.GetWorkerId(workerIndex); _c = workerId[0] << 24 | workerId[1] << 16 | workerId[2] << 8 | workerId[3]; if (processIdProvider != null) { var processId = processIdProvider.GetProcessId(); _d = processId[0] << 24 | processId[1] << 16; } else { _d = workerId[4] << 24 | workerId[5] << 16; } }
public NewIdGenerator(ITickProvider tickProvider, IWorkerIdProvider workerIdProvider, IProcessIdProvider processIdProvider = null, int workerIndex = 0) { _tickProvider = tickProvider; byte[] workerId = workerIdProvider.GetWorkerId(workerIndex); _c = workerId[0] << 24 | workerId[1] << 16 | workerId[2] << 8 | workerId[3]; if(processIdProvider != null) { var processId = processIdProvider.GetProcessId(); _d = processId[0] << 24 | processId[1] << 16; } else { _d = workerId[4] << 24 | workerId[5] << 16; } }
public NewIdGenerator(ITickProvider tickProvider, IWorkerIdProvider workerIdProvider, IProcessIdProvider processIdProvider = null, int workerIndex = 0) { _tickProvider = tickProvider; _spinLock = new SpinLock(false); var workerId = workerIdProvider.GetWorkerId(workerIndex); _c = (workerId[0] << 24) | (workerId[1] << 16) | (workerId[2] << 8) | workerId[3]; if (processIdProvider != null) { var processId = processIdProvider.GetProcessId(); _d = (processId[0] << 24) | (processId[1] << 16); } else { _d = (workerId[4] << 24) | (workerId[5] << 16); } _gb = (short)_c; _gc = (short)(_c >> 16); }
public static void SetTickProvider(ITickProvider provider) { _tickProvider = provider; }
public TickProvider(IJetConnectionProvider jetConnectionProvider, SdataContext context) { _tickProvider = new Int32TickProvider(jetConnectionProvider, context); }
public TickProvider(IJetConnectionProvider jetConnectionProvider, SdataContext context) { _tickProvider = new Int32TickProvider(jetConnectionProvider, context); }
public ColorbarLegend(AbstractDrawable parent, ITickProvider provider, ITickRenderer renderer) : this(parent, provider, renderer, Color.BLACK, Color.WHITE) { }
public ForexMarket(Instruments instrument, ITickProvider tickProvider, ICandleProvider candleProvider) : this(new ForexMarketContext(instrument, MarketState.Unknown), tickProvider, candleProvider) { }
public BackTestRunner(ICandleProvider candleProvider, ITickProvider tickProvider) { this.candleProvider = candleProvider; this.tickProvider = tickProvider; }
public Scheduler(SchedulerSettings settings, ITickProvider tickProvider) { Settings = settings; _tickProvider = tickProvider ?? throw new ArgumentNullException(nameof(tickProvider)); }
public SchedulerTests(string startTime, string stopTime) { _startTime = Convert.ToDateTime(startTime); _stopTime = Convert.ToDateTime(stopTime); _tickProvider = new TTickProvider(); }
public ColorbarImageGenerator(ColorMapper mapper, ITickProvider provider, ITickRenderer renderer) : this(mapper.ColorMap, (float)mapper.ZMin, (float)mapper.ZMax, provider, renderer) { }
public static async Task <object> GetOrCreateAnalyticWithTickProviderAsync(this Equity equity, Type analyticType, ITickProvider provider, params object[] parameters) { if (!typeof(IAnalyzable).IsAssignableFrom(analyticType)) { throw new ArgumentException($"{analyticType.Name} is not a valid object to create"); } string key = $"{equity.GetHashCode()}#{analyticType.Name}#{string.Join("|", parameters)}#{provider.GetHashCode()}"; if (!_cache.TryGetValue(key, out object output)) { var paramsList = new List <object>(); paramsList.Add(equity); paramsList.AddRange(parameters); var instance = (IAnalyzable)Activator.CreateInstance(analyticType, paramsList.ToArray()); await instance.InitWithTickProviderAsync(provider); output = _cache.Set(key, instance, _policy); } return(output); }
public static async Task <TAnalytic> GetOrCreateAnalyticWithTickProviderAsync <TAnalytic>(this Equity equity, ITickProvider provider, params object[] parameters) where TAnalytic : IAnalyzable => (TAnalytic) await GetOrCreateAnalyticWithTickProviderAsync(equity, typeof(TAnalytic), provider, parameters);