public static FilterDefinition GetFilter(string expression) { if (string.IsNullOrWhiteSpace(expression)) { return(null); } expression = expression.Replace(" ", " "); expression = expression.Trim(); var trysymbol = GetFilterBySymbol(expression); if (trysymbol != null) { return(trysymbol); } FilterDefinition filter = new FilterDefinition(); int index = expression.IndexOf(" "); if (index == -1) { filter.FieldName = expression; filter.Comparer = Comparer.EqualTo; filter.FieldValue = "true"; } else { filter.FieldName = expression.Substring(0, index); var nextindex = expression.IndexOf(" ", index + 1); if (nextindex == -1) { string compare = expression.Substring(index).Trim(); filter.Comparer = ComparerHelper.GetComparer(compare); } else { string compare = expression.Substring(index, nextindex - index); filter.Comparer = ComparerHelper.GetComparer(compare); filter.FieldValue = expression.Substring(nextindex).Trim(); } } return(filter); }
public HashSet(int c, Generic.IEqualityComparer <T> comparer) { #if DEBUG if (comparer == null) { throw new ArgumentNullException("comparer should not be null!"); } #endif m_comparer = comparer ?? ComparerHelper.GetComparer <T>(); m_lastIndex = 0; Count = 0; m_freeList = -1; int prime = HashHelpers.GetPrime(c); m_buckets = new int[prime]; m_slots = new Slot[prime]; }
public static FilterDefinition GetFilterBySymbol(string expression) { foreach (var item in ComparerList) { int index = expression.IndexOf(item); if (index > -1) { FilterDefinition filter = new FilterDefinition(); filter.FieldName = expression.Substring(0, index).Trim(); filter.FieldValue = expression.Substring(index + item.Length).Trim(); filter.Comparer = ComparerHelper.GetComparer(item); return(filter); } } return(null); }