FastQuant.DataSeries.Insert C# (CSharp) Méthode

Insert() private méthode

private Insert ( DataObject obj ) : void
obj DataObject
Résultat void
        private void Insert(DataObject obj)
        {
            Count++;
            if (this.writeKey.dateTime1 <= obj.DateTime && obj.DateTime <= this.writeKey.dateTime2)
            {
                this.writeKey.AddObject(obj);
                if (this.writeKey.count >= this.writeKey.size)
                {
                    WriteKey(this.writeKey);
                    this.writeKey = new DataKey(this.file, null, this.writeKey.position, -1L)
                    {
                        number = this.bufferCount,
                        index1 = Count,
                        index2 = Count,
                        changed = true
                    };
                    this.bufferCount++;
                    this.cache[this.writeKey.number] = this.writeKey;
                }
                else
                {
                    this.changed = true;
                }
                this.file.isModified = true;
                return;
            }

            var key = GetKey(obj.DateTime, this.insertKey, IndexOption.Prev);
            if (this.insertKey == null)
            {
                this.insertKey = key;
            }
            else if (this.insertKey != key)
            {
                if (this.insertKey.changed)
                    WriteKey(this.insertKey);
                if (!CacheObjects && this.insertKey != this.readKey && this.insertKey != this.writeKey && this.insertKey != this.deleteKey)
                    this.insertKey.objects = null;
                this.insertKey = key;
            }
            this.insertKey.GetObjects();
            if (this.insertKey.count < this.insertKey.size)
            {
                this.insertKey.AddObject(obj);
                if (this.insertKey.count == this.insertKey.size)
                    WriteKey(this.insertKey);
            }
            else
            {
                key = new DataKey(this.file, null, -1L, -1L);
                int num = this.insertKey.GetIndex(obj.DateTime, SearchOption.Next);
                if (num == -1)
                {
                    key.AddObject(obj);
                }
                else
                {
                    for (int i = num; i < this.insertKey.count; i++)
                    {
                        key.AddObject(this.insertKey.objects[i]);
                        this.insertKey.objects[i] = null;
                    }
                    this.insertKey.count = num;
                    this.insertKey.index2 = this.insertKey.index1 + this.insertKey.count - 1;
                    if (this.insertKey.count != 0)
                        this.insertKey.dateTime2 = this.insertKey.objects[this.insertKey.count - 1].DateTime;
                    this.insertKey.AddObject(obj);
                }
                InsertKey(key, this.insertKey);
            }
            if (this.readKey != null && this.readKey.number > this.insertKey.number)
            {
                this.readKey.index1 += 1;
                this.readKey.index2 += 1;
            }
            if (this.writeKey != null && this.writeKey.number > this.insertKey.number)
            {
                this.writeKey.index1 += 1;
                this.writeKey.index2 += 1;
            }
            if (this.deleteKey != null && this.deleteKey.number > this.insertKey.number)
            {
                this.deleteKey.index1 += 1;
                this.deleteKey.index2 += 1;
            }
            this.insertKey.changed = true;
            this.changed = true;
            this.file.isModified = true;
        }