public Boolean RemoveToken(String token) { Boolean output = TokenFrequency.Remove(token); output = output && TokenID.Remove(token); output = output && Tokens.Remove(token); InvokeChanged(); return output; }
/// <summary> /// Removes specified tokens from the dictionary /// </summary> /// <param name="tokens">The tokens.</param> /// <param name="inverseFilter">if set to <c>true</c> [inverse filter].</param> /// <returns></returns> public Int32 FilterTokens(List<String> tokens, Boolean inverseFilter = true) { Int32 c = 0; if (!inverseFilter) { Tokens.RemoveAll(x => tokens.Contains(x)); for (int i = 0; i < tokens.Count; i++) { TokenFrequency.Remove(tokens[i]); TokenID.Remove(tokens[i]); c++; } InvokeChanged(); return c; } List<String> toRemove = new List<string>(); if (inverseFilter) { var tkns = GetTokens(); tokens.ForEach(x => tkns.Remove(x)); toRemove.AddRange(tkns); } else { toRemove.AddRange(tokens); } foreach (String tkn in toRemove) { if (RemoveToken(tkn)) { c++; } } InvokeChanged(); return c; }