Beispiel #1
0
        private bool ReplaceSingleItem(ref AListSparseOperation <T> op, uint index)
        {
            int i;

            if (BinarySearch(index, out i))
            {
                _list.InternalArray[i].Item = op.Item;
            }
            else
            {
                if (_list.Count >= _maxNodeSize)
                {
                    return(false);
                }
                _list.Insert(i, new Entry(index, op.Item));
            }
            return(true);
        }
Beispiel #2
0
        protected override void LLInsert(int i, AListNode <K, T> child, uint indexAdjustment)
        {
            if (_childCount > 0)
            {
                // Keep _highestKey up-to-date
                K   highest;
                int i2 = i;
                if (i == _childCount)
                {
                    i2--;
                    highest = GetHighestKey(_children[_childCount - 1].Node);
                }
                else
                {
                    highest = GetHighestKey(child);
                }

                _highestKey = InternalList.Insert(i2, highest, _highestKey, _childCount - 1);
            }

            base.LLInsert(i, child, indexAdjustment);
        }
Beispiel #3
0
 public void Insert(int index, T item)
 {
     _array = InternalList.Insert(index, item, _array, _count);
     _count++;
 }