public void Stop() { lock (_lock) { _timer.Stop(); _scanners.ForEach(delegate(PortfolioProvider x) { x.OnChanged -= ProviderChanged; x.Dispose(); }); _scanners.Clear(); _items.Clear(); _infoItems.Clear(); _failingProviders.Clear(); _workingProviders.Clear(); _queryingProviders.Clear(); UtcLastUpdated = DateTime.MinValue; M.SendAsync(new LatestPriceRequestSubscription(_id, SubscriptionType.UnsubscribeAll)); M.UnregisterAsync(this); SendChangedMessageDebounced(); } }
internal void SyncPairRequests(IEnumerable <AssetPair> pairs) { lock (_timerLock) { _pairRequests.Clear(); _pairRequests.AddRange(pairs); } }
public void Clear() { if (this.Loaded) { throw new ModifiedLoadedSceneContainerException(); } _scenes.Clear(); }
public void ApplyBtc() { _failedBtc.Clear(); foreach (var i in _volume) { if (!i.ApplyBtcVolume(PriceGraph.Prices) && !i.HasVolume24Btc) { _failedBtc.Add(i.Pair); } } }
public static void TestClear() { UniqueList <string> uniqueList = new UniqueList <string> { "AA", "BBB", "CC", "DDD" }; uniqueList.Clear(); Assert.AreEqual(0, uniqueList.Count); }
public async Task <AssetPairs> GetAssetPairsAsync(NetworkProviderContext context) { if (_pairs.Any()) { return(new AssetPairs(_pairs)); } var rates = await GetRatesAsync().ConfigureAwait(false); lock (_lock) { var pairs = new AssetPairs(rates.Select(x => x.Key)); _pairs.Clear(); _pairs.AddRange(pairs); return(pairs); } }
public void OrderUniqueList() { var orderlist1 = new UniqueList <int> { 2, 9, 5, 3, 0, 1 }; var orderlist2 = new UniqueList <int> { 1, 8, 4, 2, 9, 7 }; var myComparer = new NumberComparer(); orderlist1.Sort(); orderlist2.Sort(myComparer); Assert.AreEqual(2, orderlist1[2]); Assert.AreEqual(4, orderlist2[2]); orderlist1.Clear(); Assert.AreEqual(0, orderlist1.Count); }
private int ExecuteThirdPass(AnalyseVideo analyseVideo, ParallelLoopState loopState, int currentPass) { if (analyseVideo.Candidates.Count == 0 || analyseVideo.MatchPercentage < Constants.GREAT_MATCH_FOUND_TRESHOLD) { analyseVideo.AddTitleGuesses(VideoTitleExtractor.GetTitleGuessesFromPath(analyseVideo.Video.Files[0].Path)); //TODO 004 optimize this --> also gets done in pass1 --> remember somehow UniqueList <string> titleGuesses = analyseVideo.GetTitleGuesses(); string fileNameGuess = analyseVideo.GetMainFileNameGuess(); string folderNameGuess = analyseVideo.GetMainFolderNameGuess(); titleGuesses.Clear(); foreach (string searchResult in BingSearch.Search(fileNameGuess)) { analyseVideo.AddTitleGuesses(VideoTitleExtractor.CleanTitle(searchResult)); } if (folderNameGuess != null) { foreach (string searchResult in BingSearch.Search(folderNameGuess)) { analyseVideo.AddTitleGuesses(VideoTitleExtractor.CleanTitle(searchResult)); } } FillCandidates(analyseVideo, fileNameGuess, folderNameGuess); } analyseVideo.HandledTitleGuesses(); ExecuteAfterPass(currentPass); //if (CancellationPending) //{ // e.Cancel = true; // return; //} return(currentPass); }
/// <summary> /// /// </summary> /// <param name="worldObject"></param> /// <returns>A list of all <see cref="GridLocation"/>s containing the <see cref="IWorldObject"/></returns> public List<GridLocation> Intersects(IWorldObject worldObject) { List<GridLocation> found = new List<GridLocation>(gridSize.X * gridSize.Y); List<GridLocation> missed = new List<GridLocation>(gridSize.X * gridSize.Y); UniqueList<GridLocation> toTest = new UniqueList<GridLocation>(gridSize.X * gridSize.Y); UniqueList<GridLocation> newToBeTested = new UniqueList<GridLocation>(gridSize.X * gridSize.Y); // the GridLocation that contains the center of the object GridLocation hasCenter; // STEP 1 - determine the GridLocation of the object's center Point cellCoord; // Use integer division to find cell coordinates. // Since the grid cell coords are in the upperleft corner // 1 must be subtracted from the division if we are in the negative (left or up) // direction - effectively rounding up in absolute value. if (worldObject.Position.X < 0) cellCoord.X = (Int16)(((Int16)worldObject.Position.X / (Int16)cellSize.X) - 1); else cellCoord.X = (Int16)(((Int16)worldObject.Position.X / (Int16)cellSize.X)); if (worldObject.Position.Y < 0) cellCoord.Y = (Int16)(((Int16)worldObject.Position.Y / (Int16)cellSize.Y) - 1); else cellCoord.Y = (Int16)(((Int16)worldObject.Position.Y / (Int16)cellSize.Y)); // check to makes sure these coordinates are in the world if (minGrid.X <= cellCoord.X && cellCoord.X <= maxGrid.X && minGrid.Y <= cellCoord.Y && cellCoord.Y <= maxGrid.Y) { hasCenter = new GridLocation((Int16)cellCoord.X, (Int16)cellCoord.Y, cellSize); } // if they are not in the world, return the empty list else { return found; } // add it to the found list found.Add(hasCenter); // STEP 2 - determine all surrounding GridLocations that contain the object toTest.UnionWith(GetSurrounding(hasCenter)); while (toTest.Count != 0) { foreach (GridLocation gridLocation in toTest) { // if a surrounding GridLocation intersects the object do 4 things if (worldObject.Bounds.Intersects(gridLocation.Bounds)) { // 1. Add it to the found list found.Add(gridLocation); // 2. Get its surrounding GridLocations newToBeTested.UnionWith(GetSurrounding(gridLocation)); // 3. Remove any that are already known to not contain the object foreach (GridLocation g in missed) { newToBeTested.Remove(g); } // 4. Remove any that are already known to contain the object foreach (GridLocation g in found) { newToBeTested.Remove(g); } } // if a surrounding GridLocation DOES NOT intersect the object add it to missed else { missed.Add(gridLocation); } } // since we have checked everything in toTest flush it toTest.Clear(); // add the newly found surrounding candidates to toTest toTest.UnionWith(newToBeTested); // flush the temp list newToBeTested.Clear(); } return found; }
public void Clear() { _mapping.Clear(); _values.Clear(); DefaultIncrement = HistArith.UnitValue; }
internal static void ClearAndFree <T>(this ObjectPool <UniqueList <T> > pool, UniqueList <T> list) { list.Clear(); pool.Free(list); }
public void DeleteFromEmptyList() { list.Clear(); list.Delete(2); }