/// <summary> /// Слияние двух узлов. /// </summary> /// <param name="sibling">Брат, с которым происходит слияние.</param> public override void Merge(ArrayNode <T> sibling) { LeafArrayNode <T> node = (LeafArrayNode <T>)sibling; Keys.AddRange(node.Keys); Next = node.Next; }
public IEnumerator <T> GetEnumerator() { _currentNode = new LeafArrayNode <T>(Factor); _currentNode.Next = _root?.GetFirstLeaf(); _currentNodePosition = 0; return(this); }
/// <summary> /// Деление узла. /// </summary> /// <returns>Появившийся в результате деления узел.</returns> public override ArrayNode <T> Split() { int from = Keys.Count / 2; int count = Keys.Count - from; LeafArrayNode <T> sibling = new LeafArrayNode <T>(Factor); sibling.Keys.AddRange(Keys.GetRange(from, count)); Keys = Keys.GetRange(0, from); sibling.Next = Next; Next = sibling; return(sibling); }
bool IEnumerator.MoveNext() { if (_currentNodePosition >= _currentNode.Keys.Count - 1) { _currentNode = _currentNode.Next; _currentNodePosition = 0; } else { _currentNodePosition++; } return(_currentNode != null); }
void IEnumerator.Reset() { _currentNode = _root?.GetFirstLeaf(); }