internal override uint TakeFromLeft(AListNode <int, T> leftSibling, IAListTreeObserver <int, T> tob) { var left = (SparseAListLeaf <T>)leftSibling; if (_isFrozen || left._isFrozen) { return(0); } uint amount; if (left._list.IsEmpty) { amount = left._totalCount; AdjustOffsetsStartingAt(0, ref _list, (int)amount); } else { if (IsFullLeaf) { return(0); } var entry = left._list.Last; amount = left._totalCount - entry.Offset; entry.Offset = 0; _list.PushFirst(entry); left._list.PopLast(1); AdjustOffsetsStartingAt(1, ref _list, (int)amount); } left._totalCount -= amount; _totalCount += amount; //if (tob != null) tob.ItemMoved(item, left, this); return(amount); }
internal override uint TakeFromLeft(AListNode <K, T> leftSibling, IAListTreeObserver <K, T> tob) { var left = (AListLeaf <K, T>)leftSibling; if (IsFullLeaf || _isFrozen || left._isFrozen) { return(0); } T item = left._list.Last; #if true // InternalDList _list.PushFirst(item); left._list.PopLast(1); #else // InternalList _list.Insert(0, item); left._list.RemoveAt(left._list.Count - 1); #endif if (tob != null) { tob.ItemMoved(item, left, this); } return(1); }