Exemplo n.º 1
0
        public BTH(HN heapNode, HID userRoot = null)
        {
            this.HeapNode = heapNode;

            var bthHeaderHID = userRoot ?? heapNode.HeapNodes[0].Header.UserRoot;

            this.Header = new BTHHEADER(HeapNodeBO.GetHNHIDBytes(heapNode, bthHeaderHID));
            this.Root   = new BTHIndexNode(this.Header.BTreeRoot, this, (int)this.Header.NumLevels);

            this.Properties = new Dictionary <byte[], BTHDataEntry>(new ArrayUtilities.ByteArrayComparer());

            var stack = new Stack <BTHIndexNode>();

            stack.Push(this.Root);
            while (stack.Count > 0)
            {
                var cur = stack.Pop();

                if (cur.Data != null)
                {
                    foreach (var entry in cur.Data.DataEntries)
                    {
                        this.Properties.Add(entry.Key, entry);
                    }
                }

                if (cur.Children != null)
                {
                    foreach (var child in cur.Children)
                    {
                        stack.Push(child);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public BTH(HN heapNode, HID userRoot = null)
        {
            this.HeapNode = heapNode;

            var bthHeaderHID = userRoot ?? heapNode.HeapNodes[0].Header.UserRoot;
            this.Header = new BTHHEADER(HeapNodeBO.GetHNHIDBytes(heapNode, bthHeaderHID));
            this.Root = new BTHIndexNode(this.Header.BTreeRoot, this, (int)this.Header.NumLevels);

            this.Properties = new Dictionary<byte[], BTHDataEntry>(new ArrayUtilities.ByteArrayComparer());

            var stack = new Stack<BTHIndexNode>();
            stack.Push(this.Root);
            while (stack.Count > 0)
            {
                var cur = stack.Pop();

                if (cur.Data != null)
                    foreach (var entry in cur.Data.DataEntries)
                        this.Properties.Add(entry.Key, entry);

                if (cur.Children != null)
                    foreach (var child in cur.Children)
                        stack.Push(child);

            }
        }