Example #1
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
            }
        }