예제 #1
0
        public void TestDuplicateMergeIterator()
        {
            var enumerators = new List <IEnumerable <int> >();

            enumerators.Add(Enumerable.Range(1, 10));
            Assert.AreEqual(55, MergeEnumerator.Merge(enumerators).Sum());

            enumerators = new List <IEnumerable <int> >();
            enumerators.Add(Enumerable.Range(1, 10));
            enumerators.Add(Enumerable.Range(2, 9));
            enumerators.Add(Enumerable.Range(1, 10));
            Assert.AreEqual(55, MergeEnumerator.Merge(enumerators).Sum());

            enumerators = new List <IEnumerable <int> >();
            enumerators.Add(new List <int>());
            enumerators.Add(Enumerable.Range(2, 9));
            enumerators.Add(Enumerable.Range(1, 10));
            Assert.AreEqual(55, MergeEnumerator.Merge(enumerators).Sum());
        }
예제 #2
0
        private static IEnumerable <SegmentationInput.Segment> SplitOverlappingSegments(List <SegmentationInput.Segment[]> sampleSegments)
        {
            var starts = MergeEnumerator.Merge(sampleSegments.Select(segments => segments.Select(segment => segment.start)));
            var ends   = MergeEnumerator.Merge(sampleSegments.Select(segments => segments.Select(segment => segment.end)));

            var partitions = MergeEnumerator.Merge(new[]