コード例 #1
0
        public void Remove(IReadOnlyCollection <FileVersion> fileVersions)
        {
            if (!fileVersions.Any())
            {
                return;
            }

            using (_lock.SharedIntentExclusive())
            {
                foreach (var fileVersion in fileVersions)
                {
                    var words = _directIndex[fileVersion].ToList();
                    foreach (var word in words)
                    {
                        _searchIndex.Remove(word, e => fileVersions.Contains(e.FileVersion));
                    }
                }

                using (_lock.Exclusive())
                {
                    foreach (var fileVersion in fileVersions)
                    {
                        _directIndex.Remove(fileVersion);
                    }
                }
            }
        }
コード例 #2
0
ファイル: SecurityTrie.cs プロジェクト: trevor5gs/StockSharp
 /// <summary>
 /// Remove the instrument.
 /// </summary>
 /// <param name="security">The instrument.</param>
 /// <returns><see langword="true"/> if <paramref name="security"/> was successfully removed from the <see cref="SecurityTrie"/>; otherwise, <see langword="false"/>.</returns>
 public bool Remove(Security security)
 {
     lock (_sync)
     {
         _trie.Remove(security);
         return(_allSecurities.Remove(security));
     }
 }
コード例 #3
0
        /// <summary>
        /// Remove the instrument.
        /// </summary>
        /// <param name="security">The instrument.</param>
        /// <returns><see langword="true"/> if <paramref name="security"/> was successfully removed from the <see cref="SecurityTrie"/>; otherwise, <see langword="false"/>.</returns>
        public bool Remove(Security security)
        {
            if (security is null)
            {
                throw new ArgumentNullException(nameof(security));
            }

            lock (_sync)
            {
                _trie.Remove(security);
                return(_allSecurities.Remove(security.ToSecurityId()));
            }
        }
コード例 #4
0
        private void RemoveSecurity(Security security)
        {
            lock (_sync)
            {
                _trie.Remove(security);
                _allSecurities.Remove(security);
            }

            //if (ExcludeFilter != null && ExcludeFilter(security))
            //	ExcludedCount--;

            Removed.SafeInvoke(security);
        }
コード例 #5
0
        public void TrieContractRemove2()
        {
            ITrie <String, char, String> trie = this.GetInstance();

            trie.Add("test", "a");
            trie.Add("testing", "b");

            Assert.AreEqual("a", trie["test"]);
            Assert.AreEqual("b", trie["testing"]);

            trie.Remove("testing");

            Assert.AreEqual("a", trie["test"]);
            Assert.IsNull(trie.Find("testing"));
        }
コード例 #6
0
        /// <summary>
        /// Создать <see cref="FilterableSecurityProvider"/>.
        /// </summary>
        /// <param name="securities">Инструменты.</param>
        /// <param name="excludeFilter">Фильтр для исключения инструментов.</param>
        public FilterableSecurityProvider(ISecurityList securities, Func <Security, bool> excludeFilter = null)
        {
            if (securities == null)
            {
                throw new ArgumentNullException("securities");
            }

            Securities    = securities;
            ExcludeFilter = excludeFilter;

            Securities.Added    += AddSuffix;
            Securities.Inserted += (i, s) => AddSuffix(s);

            Securities.Removed += s =>
            {
                lock (_trie)
                    _trie.Remove(s);

                if (ExcludeFilter != null && ExcludeFilter(s))
                {
                    ExcludedCount--;
                }

                SecuritiesChanged.SafeInvoke(NotifyCollectionChangedAction.Remove, s);
            };

            Securities.Cleared += () =>
            {
                lock (_trie)
                    _trie.Clear();

                ExcludedCount = 0;
                SecuritiesChanged.SafeInvoke(NotifyCollectionChangedAction.Reset, null);
            };

            Securities.ForEach(AddSuffix);
        }
コード例 #7
0
ファイル: MetaKey.cs プロジェクト: metaseed/Metakey
        public void Remove()
        {
            var r = _trie.Remove(_hotkey, eventCommand => eventCommand.Equals(EventCommand));

            Console.WriteLine(r);
        }