Пример #1
0
        public void AddRecognitionTime(double recognitionTime)
        {
            double previous = -1;

            if (RecognitionsTimesList.Count > 0)
            {
                previous = RecognitionsTimesList.Last();
            }

            RecognitionsTimesList.Add(recognitionTime);
            if (previous > 0)
            {
                IntervalsList.Add(recognitionTime - previous);
            }

            UpdateIntervalsFields();
        }
Пример #2
0
        void updateLastSectionFields(double previousDuration)
        {
            LastSectionTimeSpan          = Duration - previousDuration;
            LastSectionRecognitionsCount =
                RecognitionsTimesList.Count(d => (d > previousDuration && d <= Duration));//new Func<double, bool>(d => (d > previousDuration && d <= duration))
            int firstIndexInSection = RecognitionsTimesList.IndexOf(
                RecognitionsTimesList.Where(d => (d > previousDuration && d <= Duration)).FirstOrDefault());
            List <double> intervalsInLastSection = new List <double>(IntervalsList.Skip(firstIndexInSection));

            //validation test: the above list's count shuold be equal to lastSectionRecognitionsCount-1
            if (intervalsInLastSection.Count > 0)
            {
                LastSectionMinInterval = intervalsInLastSection.Min();
                LastSectionMaxInterval = intervalsInLastSection.Max();
                LastSectionAvgInterval = intervalsInLastSection.Sum() / intervalsInLastSection.Count;
            }
            else
            {
                LastSectionMinInterval = LastSectionMaxInterval = LastSectionAvgInterval = -10; //test
            }
        }