public void AppendDepthData(double index, double value, DateTime appendTime) { if (IsDeleted || IsTime || (DepthEndIndex != null && index <= DepthEndIndex)) { return; } DepthIndexes.Add(index); Data.Add(value); UpdateDataLastWrite(appendTime); }
private int GetDataIndex(IComparable comparable, bool inclusive, bool isStart) { if (DataCount == 0) { return(0); } if (comparable == null) { return(DataCount - 1); } if ((inclusive && comparable.CompareTo(EndIndex) > 0) || (!inclusive && comparable.CompareTo(EndIndex) >= 0)) { return(DataCount); } else if ((inclusive && comparable.CompareTo(StartIndex) <= 0) || (!inclusive && comparable.CompareTo(StartIndex) < 0)) { return(0); } else { int dataIndex; if (IsTime) { dataIndex = TimeIndexes.BinarySearch((DateTime)comparable); } else { dataIndex = DepthIndexes.BinarySearch((double)comparable); } if (dataIndex >= 0) { return(inclusive ? (isStart ? dataIndex : ++dataIndex) : (isStart ? ++dataIndex : dataIndex)); } else { return(~dataIndex); } } }