public void CopyTo(BigListItem <V>[] array, int arrayIndex) { for (BigListItem <V> item = _bigList.FirstItem; item != null; item = item.Next) { array[arrayIndex++] = item; } }
public static void MakeNodeBlack <V>(this BigListItem <V> node) { if (node != null) { node.Color = RedBlackTreeNodeColor.Black; } }
/// <summary> /// The maximum subnode of the subtree rooted by this node. O(lg n). /// This cannot be null. /// </summary> internal BigListItem <V> MaximumSubnode() { BigListItem <V> node = this; while (node.Right != null) { node = node.Right; } return(node); }
/// <summary> /// The minimum subnode of the subtree rooted by this node. O(lg n). /// This cannot be null. /// </summary> internal BigListItem <V> MinimumSubnode() { BigListItem <V> node = this; while (node.Left != null) { node = node.Left; } return(node); }
public V First() { BigListItem <V> item = FirstItem; if (item == null) { throw new InvalidOperationException("BigList is empty."); } return(item.Value); }
public bool MoveNext() { if (!_isStarted) { Current = _bigList.FirstItem; _isStarted = true; } else { Current = _next; } _next = Current?.Next; return(Current != null); }
public void Reset() { _isStarted = false; Current = null; }
public static bool IsBlack <V>(this BigListItem <V> node) => node == null || node.Color == RedBlackTreeNodeColor.Black;
public static bool IsRed <V>(this BigListItem <V> node) => node != null && node.Color == RedBlackTreeNodeColor.Red;
public bool Remove(BigListItem <V> item) => _bigList.DeleteItem(item);
public bool Contains(BigListItem <V> item) => _bigList.ContainsItem(item);
public void Add(BigListItem <V> item) => _bigList.Add(item.Value);
public V FirstOrDefault() { BigListItem <V> item = FirstItem; return(item != null ? item.Value : default);