Пример #1
0
        public void SortAndCollapse()
        {
            // collapse any overlaps
            var doCollapse        = true;
            var scrubbedIntervals = new List <Region>();

            while (doCollapse)
            {
                scrubbedIntervals.Clear();
                doCollapse = false;

                foreach (var interval in Intervals)
                {
                    var existingOverlap = scrubbedIntervals.FirstOrDefault(i => i.Overlaps(interval));

                    if (existingOverlap != null)
                    {
                        var union = existingOverlap.Merge(interval);
                        if (!scrubbedIntervals.Contains(union))
                        {
                            scrubbedIntervals.Remove(existingOverlap);
                            scrubbedIntervals.Add(union);
                            doCollapse = true; // go for another round of merging
                        }
                    }
                    else
                    {
                        scrubbedIntervals.Add(interval);
                    }
                }

                Intervals.Clear();
                Intervals.AddRange(scrubbedIntervals);
            }

            Intervals.Sort((i1, i2) => i1.StartPosition.CompareTo(i2.StartPosition));
        }
 public void Add(IBuild build, List <Build> builds)
 {
     Intervals.AddRange(CalculateMillisecondsBetweenBuilds(builds));
     Builds.AddRange(builds);
 }
 public void Add(IBuild build, List <Build> builds)
 {
     Intervals.AddRange(GetIntervalsInMilliseconds(builds));
     Durations.AddRange(GetDurationsInMilliseconds(build, builds));
 }
Пример #4
0
 public void Add(IEnumerable <Interval> intervals)
 {
     Intervals.AddRange(intervals);
     Synced = false;
 }