Beispiel #1
0
        public virtual void Normalize(int v)
        {
            if (this.gap == v)
            {
                return;
            }
            int gapLength = this.GapLength;

            if (gapLength > 0)
            {
                if (this.gap > v)
                {
                    int index  = gapLength + v;
                    int length = this.gap - v;
                    if (length > 1)
                    {
                        GapList <T> .IntraArrayCopy(this.items, v, index, length);
                    }
                    else
                    {
                        this.items[index] = this.items[v];
                        this.items[v]     = default(T);
                    }
                    this.Sync(index, this.gap - v);
                }
                else
                {
                    int length = v - this.gap;
                    if (length > 1)
                    {
                        GapList <T> .IntraArrayCopy(this.items, this.gap + gapLength, this.gap, length);
                    }
                    else
                    {
                        this.items[this.gap]             = this.items[this.gap + gapLength];
                        this.items[this.gap + gapLength] = default(T);
                    }
                    this.Sync(this.gap, v - this.gap);
                }
            }
            this.gap = v;
        }