private double GetNextInterval(IEnumerable<Entry> entries, double threshold, int count, bool reverse)
{
List<double> scoreList = new List<double>();
double previous = threshold;
double interval = 0;
foreach (Entry entry in from entry in entries where entry.Score.HasValue select entry)
{
if (!scoreList.Contains(entry.Score.Value))
{
if (reverse && entry.Score < threshold)
{
scoreList.Add(entry.Score.Value);
}
else if (!reverse && entry.Score > threshold)
{
scoreList.Add(entry.Score.Value);
}
}
}
scoreList.Sort(delegate (double d1, double d2)
{
if (d1 > d2)
{
return 1;
}
else if (d1 < d2)
{
return -1;
}
return 0;
});
if (Math.Abs(count) > scoreList.Count)
{
count = scoreList.Count;
}
if (reverse)
{
scoreList.Reverse();
}
scoreList.GetRange(0, Math.Abs(count)).ForEach(delegate (double d)
{
interval += Math.Abs(d - previous);
previous = d;
});
return interval;
}