protected virtual IReadOnlyList <Interval> GetIntervals() { var accidentalKind = AccidentalKind.Flat; var result = new IntervalsList(Absolute, accidentalKind); return(result); }
private void UpdateIntervalsFields() { if (IntervalsList.Count > 0) { AvgInterval = IntervalsList.Sum() / IntervalsList.Count; MinInterval = IntervalsList.Min(); MaxInterval = IntervalsList.Max(); } }
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(); }
protected override IReadOnlyList <Interval> GetIntervals() { var modeNotes = GetModeNotes(); var modeRoot = modeNotes.First(); var intervals = new List <Interval>(); var keys = Key.Major[modeRoot]; var key = keys.First(); foreach (var modeNote in modeNotes) { var interval = key.GetIntervalFromRoot(modeNote); intervals.Add(interval); } var result = new IntervalsList(intervals); return(result); }
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 } }