Exemplo n.º 1
0
 public IndexAttribute(string name, IndexSortOrder sortOrder)
 {
     Name      = name;
     SortOrder = sortOrder;
 }
Exemplo n.º 2
0
 public override IEnumerator GetEnumerator(Key from, Key till, IndexSortOrder order)
 {
     return base.GetEnumerator(ConvertKey(from), ConvertKey(till), order);
 }
Exemplo n.º 3
0
 public IndexAttribute(IndexSortOrder sortOrder)
 {
     SortOrder = sortOrder;
 }
Exemplo n.º 4
0
 public IndexField(Expression <Func <T, object> > field, IndexSortOrder sortOrder)
 {
     Field = field ?? throw new ArgumentNullException(nameof(field));
 }
Exemplo n.º 5
0
            internal BtreeSelectionIterator(AltBtree enclosingInstance, Key from, Key till, IndexSortOrder order)
            {
                InitBlock(enclosingInstance);
                int i, l, r;

                sp = 0;
                counter = Enclosing_Instance.updateCounter;
                if (Enclosing_Instance.height == 0)
                {
                    return;
                }

                BtreePage page = Enclosing_Instance.root;
                int h = Enclosing_Instance.height;
                this.from = from;
                this.till = till;
                this.order = order;

                pageStack = new BtreePage[h];
                posStack = new int[h];

                if (order == TenderBase.IndexSortOrder.Ascent)
                {
                    if (from == null)
                    {
                        while (--h > 0)
                        {
                            posStack[sp] = 0;
                            pageStack[sp] = page;
                            page = (BtreePage) page.items.Get(0);
                            sp += 1;
                        }

                        posStack[sp] = 0;
                        pageStack[sp] = page;
                        end = page.nItems;
                        sp += 1;
                    }
                    else
                    {
                        while (--h > 0)
                        {
                            pageStack[sp] = page;
                            l = 0;
                            r = page.nItems;
                            while (l < r)
                            {
                                i = (l + r) >> 1;
                                if (page.Compare(from, i) >= from.inclusion)
                                {
                                    l = i + 1;
                                }
                                else
                                {
                                    r = i;
                                }
                            }
                            Assert.That(r == l);
                            posStack[sp] = r;
                            page = (BtreePage) page.items.Get(r);
                            sp += 1;
                        }
                        pageStack[sp] = page;
                        l = 0;
                        r = end = page.nItems;
                        while (l < r)
                        {
                            i = (l + r) >> 1;
                            if (page.Compare(from, i) >= from.inclusion)
                            {
                                l = i + 1;
                            }
                            else
                            {
                                r = i;
                            }
                        }
                        Assert.That(r == l);
                        if (r == end)
                        {
                            sp += 1;
                            GotoNextItem(page, r - 1);
                        }
                        else
                        {
                            posStack[sp++] = r;
                        }
                    }
                    if (sp != 0 && till != null)
                    {
                        page = pageStack[sp - 1];
                        if (-page.Compare(till, posStack[sp - 1]) >= till.inclusion)
                        {
                            sp = 0;
                        }
                    }
                }
                else
                {
                    // descent order
                    if (till == null)
                    {
                        while (--h > 0)
                        {
                            pageStack[sp] = page;
                            posStack[sp] = page.nItems;
                            page = (BtreePage) page.items.Get(page.nItems);
                            sp += 1;
                        }
                        pageStack[sp] = page;
                        posStack[sp++] = page.nItems - 1;
                    }
                    else
                    {
                        while (--h > 0)
                        {
                            pageStack[sp] = page;
                            l = 0;
                            r = page.nItems;
                            while (l < r)
                            {
                                i = (l + r) >> 1;
                                if (page.Compare(till, i) >= 1 - till.inclusion)
                                {
                                    l = i + 1;
                                }
                                else
                                {
                                    r = i;
                                }
                            }
                            Assert.That(r == l);
                            posStack[sp] = r;
                            page = (BtreePage) page.items.Get(r);
                            sp += 1;
                        }
                        pageStack[sp] = page;
                        l = 0;
                        r = page.nItems;
                        while (l < r)
                        {
                            i = (l + r) >> 1;
                            if (page.Compare(till, i) >= 1 - till.inclusion)
                            {
                                l = i + 1;
                            }
                            else
                            {
                                r = i;
                            }
                        }
                        Assert.That(r == l);
                        if (r == 0)
                        {
                            sp += 1;
                            GotoNextItem(page, r);
                        }
                        else
                        {
                            posStack[sp++] = r - 1;
                        }
                    }
                    if (sp != 0 && from != null)
                    {
                        page = pageStack[sp - 1];
                        if (page.Compare(from, posStack[sp - 1]) >= from.inclusion)
                        {
                            sp = 0;
                        }
                    }
                }
            }
Exemplo n.º 6
0
 internal BtreeSelectionEntryIterator(AltBtree enclosingInstance, Key from, Key till, IndexSortOrder order)
     : base(enclosingInstance, from, till, order)
 {
     InitBlock(enclosingInstance);
 }
Exemplo n.º 7
0
 public virtual IEnumerator GetEnumerator(Key from, Key till, IndexSortOrder order)
 {
     return new BtreeSelectionIterator(this, CheckKey(from), CheckKey(till), order);
 }
Exemplo n.º 8
0
 public virtual IEnumerator GetEntryEnumerator(Key from, Key till, IndexSortOrder order)
 {
     return new ExtendEntryIterator(index.GetEntryEnumerator(from, till, order));
 }