Пример #1
0
        public void AddPoint(TimePoint point)
        {
            // Under typical usage we'll always be adding points at a later timespan anyway,
            // but just to be sure, we check from the end of the list to keep things sorted.
            int insertIndex;

            for (insertIndex = _points.Count - 1; insertIndex >= 0; --insertIndex)
            {
                if (_points[insertIndex].Time <= point.Time)
                {
                    break;
                }
            }
            ++insertIndex;
            PreInsert(insertIndex, point);
            _points.Insert(insertIndex, point);
        }
Пример #2
0
 private void PreInsert(int index, TimePoint timePoint)
 {
     if (index == 0)
     {
         Start = timePoint.Time;
     }
     if (index == _points.Count)
     {
         End = timePoint.Time;
     }
     if (_minValue == null || timePoint.Value < _minValue.Value)
     {
         _minValue = timePoint.Value;
     }
     if (_maxValue == null || timePoint.Value > _maxValue.Value)
     {
         _maxValue = timePoint.Value;
     }
     _runningTotal += timePoint.Value;
 }
Пример #3
0
 public TimePointInterval(TimePoint both)
     : this(both, both)
 {
 }
Пример #4
0
 public TimePointInterval(TimePoint start, TimePoint end)
 {
     Start = start;
     End   = end;
 }