예제 #1
0
        /// <summary>
        /// Деление узла.
        /// </summary>
        /// <returns>Появившийся в результате деления узел.</returns>
        public override TreeNode <T> Split()
        {
            int          from    = Keys.Count / 2;
            int          count   = Keys.Count - from;
            LeafNode <T> sibling = Factory.CreateLeafNode(Factor);

            sibling.Keys.AddRange(Keys.GetRange(from, count));
            Keys         = Keys.GetRange(0, from);
            sibling.Next = Next;
            Next         = sibling;
            return(sibling);
        }
예제 #2
0
        bool IEnumerator.MoveNext()
        {
            if (_currentNodePosition >= _currentNode.Keys.Count - 1)
            {
                _currentNode         = _currentNode.Next;
                _currentNodePosition = 0;
            }
            else
            {
                _currentNodePosition++;
            }

            return(_currentNode != null);
        }
예제 #3
0
 void IEnumerator.Reset()
 {
     _currentNode = _root?.GetFirstLeaf();
 }