public bool Contains(TimeStampedValue <T> item) { lock (this.SyncObject) { return(m_TimeSpanBuffer.Contains(item)); } }
public bool Remove(TimeStampedValue <T> item) { lock (this.SyncObject) { return(m_TimeSpanBuffer.Remove(item)); } }
public void Insert(int index, TimeStampedValue <T> item) { lock (this.SyncObject) { m_TimeSpanBuffer.Insert(index, item); } }
public void Add(TimeStampedValue <T> item) { lock (this.SyncObject) { m_TimeSpanBuffer.Add(item); } }
public int IndexOf(TimeStampedValue <T> item) { lock (this.SyncObject) { return(m_TimeSpanBuffer.IndexOf(item)); } }
public virtual void Add(TimeStampedValue <T> value) { RemoveOldEntries(); m_DataBuffer[m_EndIndex] = value; m_EndIndex = (m_EndIndex + 1) % m_DataBuffer.Length; if (m_EndIndex == m_StartIndex) { IncreaseDataBuffer(); } }
private void IncreaseDataBuffer() { TimeStampedValue <T>[] newDataBuffer = new TimeStampedValue <T> [m_DataBuffer.Length + m_SizeIncrement]; for (int i = 0; i < m_DataBuffer.Length; i++) { newDataBuffer[i] = this[i]; } m_StartIndex = 0; m_EndIndex = m_DataBuffer.Length; m_DataBuffer = newDataBuffer; }
protected virtual void RemoveOldEntries() { DateTime now = DateTime.Now; long cutOffAgeTicks = now.Ticks - m_MaximalAge.Ticks; while (this.Count > 0 && m_DataBuffer[m_StartIndex].TimeStamp.Ticks < cutOffAgeTicks) { //Debug.WriteLine("Removing old entry, current count: " + this.Count); m_IsReady = true; // the buffer is full TimeStampedValue <T> removedValue = m_DataBuffer[m_StartIndex]; m_StartIndex = (m_StartIndex + 1) % m_DataBuffer.Length; OnOldEntryRemoved(removedValue); //Debug.WriteLine("After removing old entry, current count: " + this.Count); //Debug.WriteLine("Age of next entry: " + new TimeSpan(now.Ticks - m_DataBuffer[m_StartIndex].TimeStamp.Ticks).TotalSeconds.ToString()); } }
public virtual void Insert(int index, TimeStampedValue <T> item) { throw new Exception("The method or operation is not implemented."); }
public virtual int IndexOf(TimeStampedValue <T> item) { throw new Exception("The method or operation is not implemented."); }
protected virtual void OnOldEntryRemoved(TimeStampedValue <T> removedValue) { }
public virtual bool Remove(TimeStampedValue <T> item) { throw new Exception("The method or operation is not implemented."); }
public virtual bool Contains(TimeStampedValue <T> item) { throw new NotImplementedException(); }