private string toString(BTree.Node node, int num, string str)
    {
        string text = "";

        BTree.Entry[] array = BTree.Node.access_100(node);
        if (num == 0)
        {
            for (int i = 0; i < BTree.Node.access_200(node); i++)
            {
                text = new StringBuilder().append(text).append(str).append(BTree.Entry.access_300(array[i])).append(" ").append(BTree.Entry.access_400(array[i])).append("\n").toString();
            }
        }
        else
        {
            for (int i = 0; i < BTree.Node.access_200(node); i++)
            {
                if (i > 0)
                {
                    text = new StringBuilder().append(text).append(str).append("(").append(BTree.Entry.access_300(array[i])).append(")\n").toString();
                }
                text = new StringBuilder().append(text).append(this.toString(BTree.Entry.access_500(array[i]), num - 1, new StringBuilder().append(str).append("     ").toString())).toString();
            }
        }
        return(text);
    }
/*	[Signature("(LBTree$Node;TKey;I)TValue;")]*/

    private object search(BTree.Node node, IComparable comparable, int num)
    {
        BTree.Entry[] array = BTree.Node.access_100(node);
        if (num == 0)
        {
            for (int i = 0; i < BTree.Node.access_200(node); i++)
            {
                if (this.eq(comparable, BTree.Entry.access_300(array[i])))
                {
                    return(BTree.Entry.access_400(array[i]));
                }
            }
        }
        else
        {
            for (int i = 0; i < BTree.Node.access_200(node); i++)
            {
                if (i + 1 == BTree.Node.access_200(node) || this.less(comparable, BTree.Entry.access_300(array[i + 1])))
                {
                    return(this.search(BTree.Entry.access_500(array[i]), comparable, num - 1));
                }
            }
        }
        return(null);
    }
/*		[LineNumberTable(24), Modifiers(Modifiers.Static | Modifiers.Synthetic)]*/
        internal static int access_208(BTree.Node node)
        {
            int num      = node.m;
            int arg_13_0 = num;

            node.m = num + 1;
            return(arg_13_0);
        }
 private BTree.Node split(BTree.Node node)
 {
     BTree.Node node2 = new BTree.Node(2, null);
     BTree.Node.access_202(node, 2);
     for (int i = 0; i < 2; i++)
     {
         BTree.Node.access_100(node2)[i] = BTree.Node.access_100(node)[2 + i];
     }
     return(node2);
 }
/*	[Signature("(LBTree$Node;TKey;TValue;I)LBTree$Node;")]*/

    private BTree.Node insert(BTree.Node node, IComparable comparable, object obj, int num)
    {
        BTree.Entry entry = new BTree.Entry(comparable, obj, null);
        int         i;

        if (num == 0)
        {
            for (i = 0; i < BTree.Node.access_200(node); i++)
            {
                if (this.less(comparable, BTree.Entry.access_300(BTree.Node.access_100(node)[i])))
                {
                    break;
                }
            }
        }
        else
        {
            i = 0;
            while (i < BTree.Node.access_200(node))
            {
                if (i + 1 == BTree.Node.access_200(node) || this.less(comparable, BTree.Entry.access_300(BTree.Node.access_100(node)[i + 1])))
                {
                    BTree.Entry[] arg_79_0 = BTree.Node.access_100(node);
                    int           arg_79_1 = i;
                    i++;
                    BTree.Node node2 = this.insert(BTree.Entry.access_500(arg_79_0[arg_79_1]), comparable, obj, num - 1);
                    if (node2 == null)
                    {
                        return(null);
                    }
                    BTree.Entry.access_302(entry, BTree.Entry.access_300(BTree.Node.access_100(node2)[0]));
                    BTree.Entry.access_502(entry, node2);
                    break;
                }
                else
                {
                    i++;
                }
            }
        }
        for (int j = BTree.Node.access_200(node); j > i; j += -1)
        {
            BTree.Node.access_100(node)[j] = BTree.Node.access_100(node)[j - 1];
        }
        BTree.Node.access_100(node)[i] = entry;
        BTree.Node.access_208(node);
        if (BTree.Node.access_200(node) < 4)
        {
            return(null);
        }
        return(this.split(node));
    }
/*	[Signature("(TKey;TValue;)V")]*/

    public virtual void put(IComparable c, object obj)
    {
        BTree.Node node = this.insert(this.root, c, obj, this.HT);
        this.N++;
        if (node == null)
        {
            return;
        }
        BTree.Node node2 = new BTree.Node(2, null);
        BTree.Node.access_100(node2)[0] = new BTree.Entry(BTree.Entry.access_300(BTree.Node.access_100(this.root)[0]), null, this.root);
        BTree.Node.access_100(node2)[1] = new BTree.Entry(BTree.Entry.access_300(BTree.Node.access_100(node)[0]), null, node);
        this.root = node2;
        this.HT++;
    }
/*		[LineNumberTable(24), Modifiers(Modifiers.Static | Modifiers.Synthetic)]*/
        internal static int access_202(BTree.Node node, int result)
        {
            node.m = result;
            return(result);
        }
/*		[LineNumberTable(24), Modifiers(Modifiers.Static | Modifiers.Synthetic)]*/
        internal static int access_200(BTree.Node node)
        {
            return(node.m);
        }
/*		[LineNumberTable(24), Modifiers(Modifiers.Static | Modifiers.Synthetic)]*/
        internal static BTree.Entry[] access_100(BTree.Node node)
        {
            return(node.children);
        }
示例#10
0
/*		[LineNumberTable(32), Modifiers(Modifiers.Static | Modifiers.Synthetic)]*/
        internal static BTree.Node access_502(BTree.Entry entry, BTree.Node result)
        {
            entry.next = result;
            return(result);
        }
示例#11
0
 public Entry(IComparable comparable, object obj, BTree.Node node)
 {
     this.key   = comparable;
     this.value = obj;
     this.next  = node;
 }
示例#12
0
 public BTree()
 {
     this.root = new BTree.Node(0, null);
 }