Пример #1
0
        public IEnumerable <object> GetAllByKey(int key)
        {
            if (dynaKeyIndex.TryGetValue(key, out List <long> offsets))
            {
                foreach (long off in offsets)
                {
                    var item = bearing.GetItem(off);
                    if (item == null)
                    {
                        continue;
                    }
                    yield return(item);
                }
            }
            long start  = 0;
            long number = keyoffsets.Count();

            if (scale != null && scale.GetDia != null)
            {
                Diapason dia = scale.GetDia(key);
                start  = dia.start;
                number = dia.numb;
            }
            var bsa = BinarySearchByKey(start, number, key);

            foreach (var off in bsa)
            {
                var item = bearing.GetItem(off);
                if (item == null)
                {
                    continue;
                }
                yield return(item);
            }
        }
Пример #2
0
        public IEnumerable <object> GetAllBySample(object sample)
        {
            long start  = 0;
            long number = keyoffsets.Count();

            if (number == 0)
            {
                goto finish;
            }
            int key = keyFun(sample);

            if (scale != null && scale.GetDia != null)
            {
                Diapason dia = scale.GetDia(key);
                start  = dia.start;
                number = dia.numb;
            }
            var bsa = BinarySearchAll(start, number, key, sample).ToArray();

            foreach (var off in bsa)
            {
                yield return(bearing.GetElement(off));
            }
            finish : { }
        }
Пример #3
0
        public IEnumerable <object> GetAllByKey(int key)
        {
            long start  = 0;
            long number = keyoffsets.Count();

            if (scale != null && scale.GetDia != null)
            {
                Diapason dia = scale.GetDia(key);
                start  = dia.start;
                number = dia.numb;
            }
            return(GetAllByKey(start, number, key)
                   .Select(off => bearing.GetElement(off)));
        }
Пример #4
0
        public IEnumerable <object> GetAllBySample(object sample)
        {
            long start  = 0;
            long number = keyoffsets.Count();
            int  key    = keyFun(sample);

            if (scale != null && scale.GetDia != null)
            {
                Diapason dia = scale.GetDia(key);
                start  = dia.start;
                number = dia.numb;
            }
            return(BinarySearchAll(start, number, key, sample)
                   .Select(off => bearing.GetElement(off)));
        }
Пример #5
0
        public IEnumerable <object> GetAllByKey(int key)
        {
            long start = 0, number = Count();

            if (scale != null && scale.GetDia != null)
            {
                Diapason dia = scale.GetDia(key);
                start  = dia.start;
                number = dia.numb;
            }
            IEnumerable <object> query = BinarySearchByKey(start, number, key)
                                         .Select(off => bearing.GetElement(off));

            return(query);
        }
Пример #6
0
        public IEnumerable <object> GetAllBySample(object sample)
        {
            var key = hashFun(sample);

            if (dynaKeyIndex.TryGetValue(key, out List <long> offsets))
            {
                foreach (long off in offsets)
                {
                    var item = bearing.GetItem(off);
                    if (item == null)
                    {
                        continue;
                    }
                    if (comp != null && comp.Compare(item, sample) != 0)
                    {
                        continue;
                    }
                    yield return(item);
                }
            }
            long start  = 0;
            long number = keyoffsets.Count();

            if (scale != null && scale.GetDia != null)
            {
                Diapason dia = scale.GetDia(key);
                start  = dia.start;
                number = dia.numb;
            }
            var bsa = BinarySearchAll(start, number, key, sample);

            foreach (var off in bsa)
            {
                var item = bearing.GetItem(off);
                if (item == null)
                {
                    continue;
                }
                if (comp != null && comp.Compare(item, sample) != 0)
                {
                    continue;
                }
                yield return(item);
            }
            //return BinarySearchAll(start, number, key, sample)
            //    .Select(off => bearing.GetItem(off))
            //    .Where(v => v != null);
        }