FastQuant.DataSeries.Add C# (CSharp) Method

Add() public method

public Add ( DataObject obj ) : void
obj DataObject
return void
        public void Add(DataObject obj)
        {
            lock (Sync)
            {
                if (obj.DateTime.Ticks == 0)
                {
                    Console.WriteLine("DataSeries::Add Error: can not add object with DateTime = 0");
                    return;
                }

                if (!this.writeOpened)
                    OpenWrite();

                if (Count == 0)
                {
                    DateTime1 = obj.DateTime;
                    DateTime2 = obj.DateTime;
                }
                else
                {
                    if (obj.DateTime < DateTime2)
                    {
                        Insert(obj);
                        return;
                    }
                    DateTime2 = obj.DateTime;
                }
                Count++;
                this.writeKey.AddObject(obj);
                if (this.writeKey.count == this.writeKey.size)
                {
                    WriteKey(this.writeKey);
                    if (!CacheObjects && this.writeKey != this.readKey && this.writeKey != this.insertKey && this.writeKey != this.deleteKey)
                        this.writeKey.objects = null;

                    this.writeKey = new DataKey(this.file, null, this.writeKey.position, -1);
                    this.writeKey.number = this.bufferCount;
                    this.writeKey.index1 = Count - 1;
                    this.writeKey.index2 = Count - 1;
                    this.writeKey.changed = true;
                    this.bufferCount++;
                    this.cache[this.writeKey.number] = this.writeKey;
                }
                this.changed = true;
                this.file.isModified = true;
            }
        }