コード例 #1
0
ファイル: IndexKey32Comp.cs プロジェクト: agmarchuk/PolarDB
        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
ファイル: IndexKey32Imm.cs プロジェクト: agmarchuk/PolarDB
        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
ファイル: IndexKey32Comp.cs プロジェクト: agmarchuk/PolarDB
        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);
        }