public IIterator Filter( FilterRequest.CountryRequest country, IdStorage ids, CountryStorage countries) { if (country.IsNull.HasValue) { if (country.IsNull.Value) { return(country.Eq == null ? _null.GetIterator() : ListHelper.EmptyInt); } } if (country.Eq == null) { return(_ids.GetIterator()); } short countryId = countries.Get(country.Eq); if (_id2AccId[countryId] != null) { return(_id2AccId[countryId].GetIterator()); } else { return(ListHelper.EmptyInt); } }
public IIterator Filter(FilterRequest.PhoneRequest phone, IdStorage idStorage) { if (phone.IsNull.HasValue) { if (phone.IsNull.Value) { return(phone.Code.HasValue ? ListHelper.EmptyInt : _null.GetIterator()); } } if (phone.Code.HasValue) { if (_code2ids.ContainsKey(phone.Code.Value)) { return(_code2ids[phone.Code.Value].GetIterator()); } else { return(ListHelper.EmptyInt); } } else { return(_ids.GetIterator()); } }
public IIterator Filter( FilterRequest.FnameRequest fname, IdStorage idStorage) { if (fname.IsNull != null) { if (fname.IsNull.Value) { if (fname.Eq == null && fname.Any.Count == 0) { return(_null.GetIterator()); } else { return(ListHelper.EmptyInt); } } } if (fname.Eq != null && fname.Any.Count > 0) { if (fname.Any.Contains(fname.Eq)) { int eqId = _storage.Get(fname.Eq); return(_byName[eqId]?.GetIterator() ?? ListHelper.EmptyInt); } else { return(ListHelper.EmptyInt); } } if (fname.Any.Count > 0) { List <IIterator> enumerators = new List <IIterator>(fname.Any.Count); for (int i = 0; i < fname.Any.Count; i++) { int nameId = _storage.Get(fname.Any[i]); if (_byName[nameId] != null) { enumerators.Add(_byName[nameId].GetIterator()); } } return(enumerators.MergeSort()); } else if (fname.Eq != null) { int eqId = _storage.Get(fname.Eq); return(_byName[eqId]?.GetIterator() ?? ListHelper.EmptyInt); } return(_ids.GetIterator()); }
public IIterator Filter(FilterRequest.SnameRequest sname, IdStorage idStorage) { if (sname.IsNull != null) { if (sname.IsNull.Value) { if (sname.Eq == null && sname.Starts == null) { return(_null.GetIterator()); } else { return(ListHelper.EmptyInt); } } } if (sname.Eq != null && sname.Starts != null) { if (sname.Eq.StartsWith(sname.Starts)) { return(_byName.GetValueOrDefault(_storage.Get(sname.Eq))?.GetIterator() ?? ListHelper.EmptyInt); } else { return(ListHelper.EmptyInt); } } if (sname.Starts != null) { List <IIterator> enumerators = new List <IIterator>(); foreach (var nameId in _storage.StartWith(sname.Starts)) { var list = _byName.GetValueOrDefault(nameId); if (list != null) { enumerators.Add(list.GetIterator()); } } return(enumerators.MergeSort()); } else if (sname.Eq != null) { return(_byName.GetValueOrDefault(_storage.Get(sname.Eq))?.GetIterator() ?? ListHelper.EmptyInt); } return(_ids.GetIterator()); }
public IIterator Filter( FilterRequest.CityRequest city, IdStorage ids, CityStorage cities) { if (city.IsNull.HasValue) { if (city.IsNull.Value) { return((city.Eq == null && city.Any.Count == 0) ? _null.GetIterator() : ListHelper.EmptyInt); } } if (city.Eq != null && city.Any.Count > 0) { if (city.Any.Contains(city.Eq)) { short cityId = cities.Get(city.Eq); return(_id2AccId[cityId]?.GetIterator() ?? ListHelper.EmptyInt); } else { return(ListHelper.EmptyInt); } } if (city.Eq != null) { short cityId = cities.Get(city.Eq); return(_id2AccId[cityId]?.GetIterator() ?? ListHelper.EmptyInt); } else if (city.Any.Count > 0) { return(ListHelper .MergeSort( city.Any .Select(x => cities.Get(x)) .Where(x => _id2AccId[x] != null) .Select(x => _id2AccId[x].GetIterator()) .ToList())); } else { return(_ids.GetIterator()); } }
public IIterator Filter( FilterRequest.EmailRequest email, DomainStorage domainStorage, IdStorage idStorage) { DelaySortedList <int> withDomain = null; if (email.Domain != null) { var domainId = domainStorage.Get(email.Domain); withDomain = _domain2ids.GetValueOrDefault(domainId); } IEnumerable <int> result = withDomain != null ? withDomain : idStorage.AsEnumerable(); if (email.Gt != null && email.Lt != null) { if (string.Compare(email.Gt, email.Lt) > 0) { return(ListHelper.EmptyInt); } return(result.Where(x => { string prefix = _emails[x].Prefix; return string.Compare(prefix, email.Gt) > 0 && string.Compare(prefix, email.Lt) < 0; }).GetIterator()); } if (email.Gt != null) { return(result .Where(x => string.Compare(_emails[x].Prefix, email.Gt) > 0) .GetIterator()); } else if (email.Lt != null) { return(result .Where(x => string.Compare(_emails[x].Prefix, email.Lt) < 0) .GetIterator()); } return(withDomain.GetIterator()); }
public IIterator Filter( FilterRequest.PremiumRequest premium, IdStorage ids) { if (premium.IsNull.HasValue) { if (premium.IsNull.Value) { return(premium.Now ? ListHelper.EmptyInt : _null.GetIterator()); } } if (premium.Now) { return(_now.GetIterator()); } else { return(_ids.GetIterator()); } }