예제 #1
0
 public bool Includes(XRange<TSource, TDistance> range) => Includes(range.actualFrom.Value) && Includes(range.actualTo.Value);
예제 #2
0
 public bool Overlaps(XRange<TSource, TDistance> range) => Includes(range.actualFrom.Value) || Includes(range.actualTo.Value);
예제 #3
0
      protected IEnumerable<IEnumerable<TSource>> toContiguousSequences(IEnumerable<TSource> sequence, XRange<TSource, TDistance> range)
      {
         sequence = sequence.OrderBy(x => x);
         var enumerator = sequence.GetEnumerator();
         if (!enumerator.MoveNext())
         {
            throw new InvalidOperationException("Sequence is empty");
         }

         var currentList = new List<TSource> { enumerator.Current };
         while (enumerator.MoveNext())
         {
            var current = enumerator.Current;
            var textNextValue = range.nextValue(currentList.Last());
            if (current.Equals(textNextValue))
            {
               currentList.Add(current);
            }
            else
            {
               yield return currentList;

               currentList = new List<TSource> { current };
            }
         }

         yield return currentList;
      }