@@ -47,6 +47,113 @@ public static CompositeRange<T, TKey> ToCompositeRange<TSource, T, TKey>(
4747 . ToCompositeRange ( ) ;
4848 #endregion
4949
50+ #region ToCompositeRangeExclusive
51+ /// <summary>Converts sequence of elements to the composite range.</summary>
52+ /// <typeparam name="T">The type of the range values.</typeparam>
53+ /// <typeparam name="TKey">The type of the range key</typeparam>
54+ /// <param name="source">Original collection.</param>
55+ /// <param name="fromValueSelector">Callback to obtain a value for the From boundary.</param>
56+ /// <param name="toValueSelector">Callback to obtain a value for the To boundary.</param>
57+ /// <returns>A new composite range with keys filled from the original collection.</returns>
58+ [ Pure ]
59+ public static CompositeRange < T , TKey > ToCompositeRangeExclusive < T , TKey > (
60+ [ NotNull ] this IEnumerable < TKey > source ,
61+ [ NotNull , InstantHandle ] Func < TKey , T > fromValueSelector ,
62+ [ NotNull , InstantHandle ] Func < TKey , T > toValueSelector ) =>
63+ source
64+ . Select ( s => Range . CreateExclusive ( fromValueSelector ( s ) , toValueSelector ( s ) , s ) )
65+ . ToCompositeRange ( ) ;
66+
67+ /// <summary>Converts sequence of elements to the composite range.</summary>
68+ /// <typeparam name="TSource">The type of the values in original collection.</typeparam>
69+ /// <typeparam name="T">The type of the range values.</typeparam>
70+ /// <typeparam name="TKey">The type of the range key</typeparam>
71+ /// <param name="source">Original collection.</param>
72+ /// <param name="fromValueSelector">Callback to obtain a value for the From boundary.</param>
73+ /// <param name="toValueSelector">Callback to obtain a value for the To boundary.</param>
74+ /// <param name="keySelector">Callback to obtain a value for the range key.</param>
75+ /// <returns>A new composite range with keys filled from the original collection.</returns>
76+ [ Pure ]
77+ public static CompositeRange < T , TKey > ToCompositeRangeExclusive < TSource , T , TKey > (
78+ [ NotNull ] this IEnumerable < TSource > source ,
79+ [ NotNull , InstantHandle ] Func < TSource , T > fromValueSelector ,
80+ [ NotNull , InstantHandle ] Func < TSource , T > toValueSelector ,
81+ [ NotNull , InstantHandle ] Func < TSource , TKey > keySelector ) =>
82+ source
83+ . Select ( s => Range . CreateExclusive ( fromValueSelector ( s ) , toValueSelector ( s ) , keySelector ( s ) ) )
84+ . ToCompositeRange ( ) ;
85+
86+ /// <summary>Converts sequence of elements to the composite range.</summary>
87+ /// <typeparam name="T">The type of the range values.</typeparam>
88+ /// <typeparam name="TKey">The type of the range key</typeparam>
89+ /// <param name="source">Original collection.</param>
90+ /// <param name="fromValueSelector">Callback to obtain a value for the From boundary.</param>
91+ /// <param name="toValueSelector">Callback to obtain a value for the To boundary.</param>
92+ /// <returns>A new composite range with keys filled from the original collection.</returns>
93+ [ Pure ]
94+ public static CompositeRange < T , TKey > ToCompositeRangeExclusiveFrom < T , TKey > (
95+ [ NotNull ] this IEnumerable < TKey > source ,
96+ [ NotNull , InstantHandle ] Func < TKey , T > fromValueSelector ,
97+ [ NotNull , InstantHandle ] Func < TKey , T > toValueSelector ) =>
98+ source
99+ . Select ( s => Range . CreateExclusiveFrom ( fromValueSelector ( s ) , toValueSelector ( s ) , s ) )
100+ . ToCompositeRange ( ) ;
101+
102+ /// <summary>Converts sequence of elements to the composite range.</summary>
103+ /// <typeparam name="TSource">The type of the values in original collection.</typeparam>
104+ /// <typeparam name="T">The type of the range values.</typeparam>
105+ /// <typeparam name="TKey">The type of the range key</typeparam>
106+ /// <param name="source">Original collection.</param>
107+ /// <param name="fromValueSelector">Callback to obtain a value for the From boundary.</param>
108+ /// <param name="toValueSelector">Callback to obtain a value for the To boundary.</param>
109+ /// <param name="keySelector">Callback to obtain a value for the range key.</param>
110+ /// <returns>A new composite range with keys filled from the original collection.</returns>
111+ [ Pure ]
112+ public static CompositeRange < T , TKey > ToCompositeRangeExclusiveFrom < TSource , T , TKey > (
113+ [ NotNull ] this IEnumerable < TSource > source ,
114+ [ NotNull , InstantHandle ] Func < TSource , T > fromValueSelector ,
115+ [ NotNull , InstantHandle ] Func < TSource , T > toValueSelector ,
116+ [ NotNull , InstantHandle ] Func < TSource , TKey > keySelector ) =>
117+ source
118+ . Select ( s => Range . CreateExclusiveFrom ( fromValueSelector ( s ) , toValueSelector ( s ) , keySelector ( s ) ) )
119+ . ToCompositeRange ( ) ;
120+
121+ /// <summary>Converts sequence of elements to the composite range.</summary>
122+ /// <typeparam name="T">The type of the range values.</typeparam>
123+ /// <typeparam name="TKey">The type of the range key</typeparam>
124+ /// <param name="source">Original collection.</param>
125+ /// <param name="fromValueSelector">Callback to obtain a value for the From boundary.</param>
126+ /// <param name="toValueSelector">Callback to obtain a value for the To boundary.</param>
127+ /// <returns>A new composite range with keys filled from the original collection.</returns>
128+ [ Pure ]
129+ public static CompositeRange < T , TKey > ToCompositeRangeExclusiveTo < T , TKey > (
130+ [ NotNull ] this IEnumerable < TKey > source ,
131+ [ NotNull , InstantHandle ] Func < TKey , T > fromValueSelector ,
132+ [ NotNull , InstantHandle ] Func < TKey , T > toValueSelector ) =>
133+ source
134+ . Select ( s => Range . CreateExclusiveTo ( fromValueSelector ( s ) , toValueSelector ( s ) , s ) )
135+ . ToCompositeRange ( ) ;
136+
137+ /// <summary>Converts sequence of elements to the composite range.</summary>
138+ /// <typeparam name="TSource">The type of the values in original collection.</typeparam>
139+ /// <typeparam name="T">The type of the range values.</typeparam>
140+ /// <typeparam name="TKey">The type of the range key</typeparam>
141+ /// <param name="source">Original collection.</param>
142+ /// <param name="fromValueSelector">Callback to obtain a value for the From boundary.</param>
143+ /// <param name="toValueSelector">Callback to obtain a value for the To boundary.</param>
144+ /// <param name="keySelector">Callback to obtain a value for the range key.</param>
145+ /// <returns>A new composite range with keys filled from the original collection.</returns>
146+ [ Pure ]
147+ public static CompositeRange < T , TKey > ToCompositeRangeExclusiveTo < TSource , T , TKey > (
148+ [ NotNull ] this IEnumerable < TSource > source ,
149+ [ NotNull , InstantHandle ] Func < TSource , T > fromValueSelector ,
150+ [ NotNull , InstantHandle ] Func < TSource , T > toValueSelector ,
151+ [ NotNull , InstantHandle ] Func < TSource , TKey > keySelector ) =>
152+ source
153+ . Select ( s => Range . CreateExclusiveTo ( fromValueSelector ( s ) , toValueSelector ( s ) , keySelector ( s ) ) )
154+ . ToCompositeRange ( ) ;
155+ #endregion
156+
50157 #region ToCompositeRangeFrom & ToCompositeRangeTo
51158 /// <summary>
52159 /// Converts sequence of elements to the composite range using only From boundary.
0 commit comments