99using Xtensive . Collections ;
1010using System . Linq ;
1111using Xtensive . Core ;
12-
12+ using DotNetNotNullAttribute = System . Diagnostics . CodeAnalysis . NotNullAttribute ;
13+ using JBNotNullAttribute = JetBrains . Annotations . NotNullAttribute ;
14+ using JBCanBeNullAttribute = JetBrains . Annotations . CanBeNullAttribute ;
1315
1416namespace Xtensive . Sorting
1517{
@@ -29,6 +31,7 @@ public static class TopologicalSorter
2931 /// Sorting result, if there were no loops;
3032 /// otherwise, <see langword="null"/>.
3133 /// </returns>
34+ [ JBCanBeNull ]
3235 public static IEnumerable < TNodeItem > Sort < TNodeItem > ( IEnumerable < TNodeItem > items , Predicate < TNodeItem , TNodeItem > connector ) =>
3336 Sort ( items , connector , out List < Node < TNodeItem , object > > loops ) ;
3437
@@ -43,6 +46,7 @@ public static IEnumerable<TNodeItem> Sort<TNodeItem>(IEnumerable<TNodeItem> item
4346 /// Sorting result, if there were no loops;
4447 /// otherwise, <see langword="null"/>.
4548 /// </returns>
49+ [ JBCanBeNull ]
4650 public static IReadOnlyList < TNodeItem > SortToList < TNodeItem > ( IEnumerable < TNodeItem > items , Predicate < TNodeItem , TNodeItem > connector ) =>
4751 SortToList ( items , connector , out List < Node < TNodeItem , object > > loops ) ;
4852
@@ -59,6 +63,7 @@ public static IReadOnlyList<TNodeItem> SortToList<TNodeItem>(IEnumerable<TNodeIt
5963 /// otherwise, <see langword="null"/>.
6064 /// In this case <paramref name="loops"/> will contain only the loop edges.
6165 /// </returns>
66+ [ JBCanBeNull ]
6267 public static IEnumerable < TNodeItem > Sort < TNodeItem > (
6368 IEnumerable < TNodeItem > items ,
6469 Predicate < TNodeItem , TNodeItem > connector ,
@@ -83,6 +88,7 @@ public static IEnumerable<TNodeItem> Sort<TNodeItem>(
8388 /// otherwise, <see langword="null"/>.
8489 /// In this case <paramref name="loops"/> will contain only the loop edges.
8590 /// </returns>
91+ [ JBCanBeNull ]
8692 public static IReadOnlyList < TNodeItem > SortToList < TNodeItem > (
8793 IEnumerable < TNodeItem > items ,
8894 Predicate < TNodeItem , TNodeItem > connector ,
@@ -105,6 +111,8 @@ public static IReadOnlyList<TNodeItem> SortToList<TNodeItem>(
105111 /// <returns>
106112 /// Sorting result
107113 /// </returns>
114+ [ return : DotNetNotNull ]
115+ [ JBNotNull ]
108116 public static IEnumerable < TNodeItem > Sort < TNodeItem > (
109117 IEnumerable < TNodeItem > items ,
110118 Predicate < TNodeItem , TNodeItem > connector ,
@@ -121,6 +129,8 @@ public static IEnumerable<TNodeItem> Sort<TNodeItem>(
121129 /// <returns>
122130 /// Sorting result
123131 /// </returns>
132+ [ return : DotNetNotNull ]
133+ [ JBNotNull ]
124134 public static IReadOnlyList < TNodeItem > SortToList < TNodeItem > (
125135 IEnumerable < TNodeItem > items ,
126136 Predicate < TNodeItem , TNodeItem > connector ,
@@ -138,6 +148,8 @@ public static IReadOnlyList<TNodeItem> SortToList<TNodeItem>(
138148 /// <returns>
139149 /// Sorting result
140150 /// </returns>
151+ [ return : DotNetNotNull ]
152+ [ JBNotNull ]
141153 public static IEnumerable < TNodeItem > Sort < TNodeItem > (
142154 IEnumerable < TNodeItem > items ,
143155 Predicate < TNodeItem , TNodeItem > connector ,
@@ -161,6 +173,8 @@ public static IEnumerable<TNodeItem> Sort<TNodeItem>(
161173 /// <returns>
162174 /// Sorting result
163175 /// </returns>
176+ [ return : DotNetNotNull ]
177+ [ JBNotNull ]
164178 public static IReadOnlyList < TNodeItem > SortToList < TNodeItem > (
165179 IEnumerable < TNodeItem > items ,
166180 Predicate < TNodeItem , TNodeItem > connector ,
@@ -181,6 +195,7 @@ public static IReadOnlyList<TNodeItem> SortToList<TNodeItem>(
181195 /// <returns>Sorting result, if there were no loops;
182196 /// otherwise, <see langword="null" />.
183197 /// In this case <paramref name="nodes"/> will contain only the loop edges.</returns>
198+ [ JBCanBeNull ]
184199 public static IEnumerable < TNodeItem > Sort < TNodeItem , TConnectionItem > (
185200 List < Node < TNodeItem , TConnectionItem > > nodes ,
186201 out List < Node < TNodeItem , TConnectionItem > > loops )
@@ -200,6 +215,7 @@ public static IEnumerable<TNodeItem> Sort<TNodeItem, TConnectionItem>(
200215 /// <returns>Sorting result, if there were no loops;
201216 /// otherwise, <see langword="null" />.
202217 /// In this case <paramref name="nodes"/> will contain only the loop edges.</returns>
218+ [ JBCanBeNull ]
203219 public static IReadOnlyList < TNodeItem > SortToList < TNodeItem , TConnectionItem > (
204220 List < Node < TNodeItem , TConnectionItem > > nodes ,
205221 out List < Node < TNodeItem , TConnectionItem > > loops )
@@ -219,6 +235,8 @@ public static IReadOnlyList<TNodeItem> SortToList<TNodeItem, TConnectionItem>(
219235 /// <param name="nodes">The nodes.</param>
220236 /// <param name="removedEdges">Edges removed to make graph non-cyclic.</param>
221237 /// <returns>Sorting result.</returns>
238+ [ return : DotNetNotNull ]
239+ [ JBNotNull ]
222240 public static IEnumerable < TNodeItem > Sort < TNodeItem , TConnectionItem > (
223241 IEnumerable < Node < TNodeItem , TConnectionItem > > nodes ,
224242 out List < NodeConnection < TNodeItem , TConnectionItem > > removedEdges ) =>
@@ -231,6 +249,8 @@ public static IEnumerable<TNodeItem> Sort<TNodeItem, TConnectionItem>(
231249 /// <param name="nodes">The nodes.</param>
232250 /// <param name="removedEdges">Edges removed to make graph non-cyclic.</param>
233251 /// <returns>Sorting result.</returns>
252+ [ return : DotNetNotNull ]
253+ [ JBNotNull ]
234254 public static IReadOnlyList < TNodeItem > SortToList < TNodeItem , TConnectionItem > (
235255 IEnumerable < Node < TNodeItem , TConnectionItem > > nodes ,
236256 out List < NodeConnection < TNodeItem , TConnectionItem > > removedEdges ) =>
@@ -244,6 +264,8 @@ public static IReadOnlyList<TNodeItem> SortToList<TNodeItem, TConnectionItem>(
244264 /// <param name="removedEdges">Edges removed to make graph non-cyclic.</param>
245265 /// <param name="removeWholeNode">If <see langword="true"/> removes whole node in the case of loop, otherwise removes only one edge.</param>
246266 /// <returns>Sorting result.</returns>
267+ [ return : DotNetNotNull ]
268+ [ JBNotNull ]
247269 public static IEnumerable < TNodeItem > Sort < TNodeItem , TConnectionItem > (
248270 IEnumerable < Node < TNodeItem , TConnectionItem > > nodes ,
249271 out List < NodeConnection < TNodeItem , TConnectionItem > > removedEdges ,
@@ -258,6 +280,8 @@ public static IEnumerable<TNodeItem> Sort<TNodeItem, TConnectionItem>(
258280 /// <param name="removedEdges">Edges removed to make graph non-cyclic.</param>
259281 /// <param name="removeWholeNode">If <see langword="true"/> removes whole node in the case of loop, otherwise removes only one edge.</param>
260282 /// <returns>Sorting result.</returns>
283+ [ return : DotNetNotNull ]
284+ [ JBNotNull ]
261285 public static IReadOnlyList < TNodeItem > SortToList < TNodeItem , TConnectionItem > (
262286 IEnumerable < Node < TNodeItem , TConnectionItem > > nodes ,
263287 out List < NodeConnection < TNodeItem , TConnectionItem > > removedEdges ,
0 commit comments