public CompositeRange <T> MakeInclusive( [NotNull, InstantHandle] Func <T, T> fromValueSelector, [NotNull, InstantHandle] Func <T, T> toValueSelector) { if (IsEmpty) { return(this); } return(SubRanges .Select(r => r.MakeInclusive(fromValueSelector, toValueSelector)) .ToCompositeRange()); }
public CompositeRange <T, TKey> MakeExclusive( [InstantHandle] Func <T, T> fromValueSelector, [InstantHandle] Func <T, T> toValueSelector) { if (IsEmpty) { return(this); } return(SubRanges .Select(r => r.MakeExclusive(fromValueSelector, toValueSelector)) .Where(r => r.IsNotEmpty) .ToCompositeRange()); }
public CompositeRange <T, TKey2> WithKeys <TKey2>(TKey2 key) => IsEmpty ? CompositeRange <T, TKey2> .Empty : SubRanges.Select(s => s.WithKey(key)).ToCompositeRange();
internal IEnumerable <Range <T> > GetMergedRanges() => _hasRangesToMerge ? MergeRangesNoKeyCore(SubRanges) : SubRanges.Select(r => r.WithoutKey());
public CompositeRange <T> WithoutKeys() => IsEmpty ? CompositeRange <T> .Empty : SubRanges.Select(s => s.WithoutKey()).ToCompositeRange();
public CompositeRange <T, TKey2> WithKeys <TKey2>( [NotNull, InstantHandle] Func <TKey, TKey2> keySelector) => IsEmpty ? CompositeRange <T, TKey2> .Empty : SubRanges.Select(s => s.WithKey(keySelector(s.Key))).ToCompositeRange();
public CompositeRange <T2> WithValues <T2>( [NotNull, InstantHandle] Func <T, T2> fromValueSelector, [NotNull, InstantHandle] Func <T, T2> toValueSelector) => IsEmpty ? CompositeRange <T2> .Empty : SubRanges.Select(s => s.WithValues(fromValueSelector, toValueSelector)).ToCompositeRange();
public CompositeRange <T2, TKey> WithValues <T2>( [NotNull, InstantHandle] Func <T, T2> newValueSelector) => IsEmpty ? CompositeRange <T2, TKey> .Empty : SubRanges.Select(s => s.WithValues(newValueSelector)).ToCompositeRange();
private IEnumerable <Range <T> > GetMergedRanges() => _hasRangesToMerge ? MergeRangesCore() : SubRanges.Select(r => r.WithoutKey());