Exemplo n.º 1
0
        private void AddForConsolidation(HeapNode newRoots)
        {
            Debug.Assert(newRoots != null);

            foreach (var root in newRoots.GetSiblings())
            {
                Debug.Assert(root.LeftSibling != null && root.RightSibling != null);
            }

            newRoots.Parent = null;

            if (_consolidateRoots == null)
            {
                _consolidateRoots = newRoots;
            }
            else
            {
                _consolidateRoots.InsertBefore(newRoots);
            }

            foreach (var root in newRoots.GetSiblings())
            {
                Debug.Assert(root.LeftSibling != null && root.RightSibling != null);
            }
        }