Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4ca8b20

Browse files
committed
Add documentation comments
1 parent 3b8f574 commit 4ca8b20

File tree

1 file changed

+81
-13
lines changed

1 file changed

+81
-13
lines changed

‎src/AlgorithmForce.Searching/Extensions.cs‎

Lines changed: 81 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ public static int IndexOf<T>(this IReadOnlyList<T> s, IReadOnlyList<T> t, IEqual
5959
/// If <paramref name="t"/> is empty, the return value is 0.
6060
/// </returns>
6161
/// <exception cref="ArgumentNullException"><paramref name="s"/> or <paramref name="t"/> is null.</exception>
62+
/// <exception cref="ArgumentOutOfRangeException">
63+
/// <paramref name="startIndex"/> is less than zero or greater than <see cref="IReadOnlyCollection{T}.Count">Count</see> of <paramref name="s"/>.
64+
/// </exception>
6265
public static int IndexOf<T>(this IReadOnlyList<T> s, IReadOnlyList<T> t, int startIndex)
6366
where T : IEquatable<T>
6467
{
@@ -80,6 +83,9 @@ public static int IndexOf<T>(this IReadOnlyList<T> s, IReadOnlyList<T> t, int st
8083
/// If <paramref name="t"/> is empty, the return value is 0.
8184
/// </returns>
8285
/// <exception cref="ArgumentNullException"><paramref name="s"/> or <paramref name="t"/> is null.</exception>
86+
/// <exception cref="ArgumentOutOfRangeException">
87+
/// <paramref name="startIndex"/> is less than zero or greater than <see cref="IReadOnlyCollection{T}.Count">Count</see> of <paramref name="s"/>.
88+
/// </exception>
8389
public static int IndexOf<T>(this IReadOnlyList<T> s, IReadOnlyList<T> t, int startIndex, IEqualityComparer<T> comparer)
8490
where T : IEquatable<T>
8591
{
@@ -199,7 +205,7 @@ public static int IndexOf(this string s, IReadOnlyList<char> t, int startIndex,
199205
#region IReadOnlyList(T) (LastIndexOf)
200206

201207
/// <summary>
202-
/// Reports the zero-based index of the first occurrence of the specified collection in this instance.
208+
/// Reports the zero-based index of the last occurrence of the specified collection in this instance.
203209
/// </summary>
204210
/// <param name="s">The current collection.</param>
205211
/// <param name="t">The collection to seek.</param>
@@ -216,7 +222,7 @@ public static int LastIndexOf<T>(this IReadOnlyList<T> s, IReadOnlyList<T> t)
216222
}
217223

218224
/// <summary>
219-
/// Reports the zero-based index of the first occurrence of the specified collection in this instance
225+
/// Reports the zero-based index of the last occurrence of the specified collection in this instance
220226
/// and uses the specified <see cref="IEqualityComparer{T}"/>.
221227
/// </summary>
222228
/// <param name="s">The current collection.</param>
@@ -235,7 +241,7 @@ public static int LastIndexOf<T>(this IReadOnlyList<T> s, IReadOnlyList<T> t, IE
235241
}
236242

237243
/// <summary>
238-
/// Reports the zero-based index of the first occurrence of the specified collection in this instance.
244+
/// Reports the zero-based index of the last occurrence of the specified collection in this instance.
239245
/// The search starts at a specified character position.
240246
/// </summary>
241247
/// <param name="s">The current collection.</param>
@@ -247,15 +253,17 @@ public static int LastIndexOf<T>(this IReadOnlyList<T> s, IReadOnlyList<T> t, IE
247253
/// If <paramref name="t"/> is empty, the return value is the last index position in this instance.
248254
/// </returns>
249255
/// <exception cref="ArgumentNullException"><paramref name="s"/> or <paramref name="t"/> is null.</exception>
250-
/// <exception cref="ArgumentOutOfRangeException"><paramref name="startIndex"/> is less than 0 or greater than the length of this string.</exception>
256+
/// <exception cref="ArgumentOutOfRangeException">
257+
/// <paramref name="startIndex"/> is less than zero or greater than <see cref="IReadOnlyCollection{T}.Count">Count</see> of <paramref name="s"/>.
258+
/// </exception>
251259
public static int LastIndexOf<T>(this IReadOnlyList<T> s, IReadOnlyList<T> t, int startIndex)
252260
where T : IEquatable<T>
253261
{
254262
return s.LastIndexOf(t, startIndex, EqualityComparer<T>.Default);
255263
}
256264

257265
/// <summary>
258-
/// Reports the zero-based index of the first occurrence of the specified collection in this instance
266+
/// Reports the zero-based index of the last occurrence of the specified collection in this instance
259267
/// and uses the specified <see cref="IEqualityComparer{T}"/>.
260268
/// The search starts at a specified character position.
261269
/// </summary>
@@ -269,7 +277,9 @@ public static int LastIndexOf<T>(this IReadOnlyList<T> s, IReadOnlyList<T> t, in
269277
/// If <paramref name="t"/> is empty, the return value is the last index position in this instance.
270278
/// </returns>
271279
/// <exception cref="ArgumentNullException"><paramref name="s"/> or <paramref name="t"/> is null.</exception>
272-
/// <exception cref="ArgumentOutOfRangeException"><paramref name="startIndex"/> is less than 0 or greater than the length of this string.</exception>
280+
/// <exception cref="ArgumentOutOfRangeException">
281+
/// <paramref name="startIndex"/> is less than zero or greater than <see cref="IReadOnlyCollection{T}.Count">Count</see> of <paramref name="s"/>.
282+
/// </exception>
273283
public static int LastIndexOf<T>(this IReadOnlyList<T> s, IReadOnlyList<T> t, int startIndex, IEqualityComparer<T> comparer)
274284
where T : IEquatable<T>
275285
{
@@ -315,7 +325,7 @@ public static int LastIndexOf<T>(this IReadOnlyList<T> s, IReadOnlyList<T> t, in
315325
#region String (LastIndexOf)
316326

317327
/// <summary>
318-
/// Reports the zero-based index of the first occurrence of the specified character collection in this instance.
328+
/// Reports the zero-based index of the last occurrence of the specified character collection in this instance.
319329
/// </summary>
320330
/// <param name="s">The string instance.</param>
321331
/// <param name="t">The character collection to seek.</param>
@@ -330,7 +340,7 @@ public static int LastIndexOf(this string s, IReadOnlyList<char> t)
330340
}
331341

332342
/// <summary>
333-
/// Reports the zero-based index of the first occurrence of the specified character collection in this instance
343+
/// Reports the zero-based index of the last occurrence of the specified character collection in this instance
334344
/// and uses the specified <see cref="IEqualityComparer{Char}"/>.
335345
/// </summary>
336346
/// <param name="s">The string instance.</param>
@@ -347,7 +357,7 @@ public static int LastIndexOf(this string s, IReadOnlyList<char> t, EqualityComp
347357
}
348358

349359
/// <summary>
350-
/// Reports the zero-based index of the first occurrence of the specified character collection in this instance.
360+
/// Reports the zero-based index of the last occurrence of the specified character collection in this instance.
351361
/// The search starts at a specified character position.
352362
/// </summary>
353363
/// <param name="s">The string instance.</param>
@@ -363,9 +373,9 @@ public static int LastIndexOf(this string s, IReadOnlyList<char> t, int startInd
363373
{
364374
return s.AsReadOnlyList().LastIndexOf(t, startIndex, EqualityComparer<char>.Default);
365375
}
366-
376+
367377
/// <summary>
368-
/// Reports the zero-based index of the first occurrence of the specified character collection in this instance
378+
/// Reports the zero-based index of the last occurrence of the specified character collection in this instance
369379
/// and uses the specified <see cref="IEqualityComparer{Char}"/>.
370380
/// The search starts at a specified character position.
371381
/// </summary>
@@ -387,25 +397,83 @@ public static int LastIndexOf(this string s, IReadOnlyList<char> t, int startInd
387397
#endregion
388398

389399
#region IReadOnlyList(T) (IndexesOf)
390-
400+
401+
/// <summary>
402+
/// Enumerates each zero-based index of all occurrences of the specified collection in this instance.
403+
/// </summary>
404+
/// <param name="s">The current collection.</param>
405+
/// <param name="t">The collection to seek.</param>
406+
/// <typeparam name="T">The type of element in the collection.</typeparam>
407+
/// <returns>
408+
/// The zero-based index positions of value if one or more <paramref name="t"/> is found.
409+
/// If <paramref name="t"/> is empty, no indexes will be enumerated.
410+
/// </returns>
411+
/// <exception cref="ArgumentNullException"><paramref name="s"/> or <paramref name="t"/> is null.</exception>
391412
public static IEnumerable<int> IndexesOf<T>(this IReadOnlyList<T> s, IReadOnlyList<T> t)
392413
where T : IEquatable<T>
393414
{
394415
return s.IndexesOf(t, 0, EqualityComparer<T>.Default);
395416
}
396417

418+
/// <summary>
419+
/// Enumerates each zero-based index of all occurrences of the specified collection in this instance
420+
/// and uses the specified <see cref="IEqualityComparer{T}"/>.
421+
/// </summary>
422+
/// <param name="s">The current collection.</param>
423+
/// <param name="t">The collection to seek.</param>
424+
/// <param name="comparer">The specified <see cref="IEqualityComparer{T}"/> instance.</param>
425+
/// <typeparam name="T">The type of element in the collection.</typeparam>
426+
/// <returns>
427+
/// The zero-based index positions of value if one or more <paramref name="t"/> is found.
428+
/// If <paramref name="t"/> is empty, no indexes will be enumerated.
429+
/// </returns>
430+
/// <exception cref="ArgumentNullException"><paramref name="s"/> or <paramref name="t"/> is null.</exception>
397431
public static IEnumerable<int> IndexesOf<T>(this IReadOnlyList<T> s, IReadOnlyList<T> t, IEqualityComparer<T> comparer)
398432
where T : IEquatable<T>
399433
{
400434
return s.IndexesOf(t, 0, comparer);
401435
}
402436

437+
/// <summary>
438+
/// Enumerates each zero-based index of all occurrences of the specified collection in this instance.
439+
/// The search starts at a specified position.
440+
/// </summary>
441+
/// <param name="s">The current collection.</param>
442+
/// <param name="t">The collection to seek.</param>
443+
/// <param name="startIndex">The search starting position.</param>
444+
/// <typeparam name="T">The type of element in the collection.</typeparam>
445+
/// <returns>
446+
/// The zero-based index positions of value if one or more <paramref name="t"/> is found.
447+
/// If <paramref name="t"/> is empty, no indexes will be enumerated.
448+
/// </returns>
449+
/// <exception cref="ArgumentNullException"><paramref name="s"/> or <paramref name="t"/> is null.</exception>
450+
/// <exception cref="ArgumentOutOfRangeException">
451+
/// <paramref name="startIndex"/> is less than zero or greater than <see cref="IReadOnlyCollection{T}.Count">Count</see> of <paramref name="s"/>.
452+
/// </exception>
403453
public static IEnumerable<int> IndexesOf<T>(this IReadOnlyList<T> s, IReadOnlyList<T> t, int startIndex)
404454
where T : IEquatable<T>
405455
{
406456
return s.IndexesOf(t, startIndex, EqualityComparer<T>.Default);
407457
}
408458

459+
/// <summary>
460+
/// Enumerates each zero-based index of all occurrences of the specified collection in this instance
461+
/// and uses the specified <see cref="IEqualityComparer{T}"/>.
462+
/// The search starts at a specified position.
463+
/// </summary>
464+
/// <param name="s">The current collection.</param>
465+
/// <param name="t">The collection to seek.</param>
466+
/// <param name="startIndex">The search starting position.</param>
467+
/// <param name="comparer">The specified <see cref="IEqualityComparer{T}"/> instance.</param>
468+
/// <typeparam name="T">The type of element in the collection.</typeparam>
469+
/// <returns>
470+
/// The zero-based index positions of value if one or more <paramref name="t"/> is found.
471+
/// If <paramref name="t"/> is empty, no indexes will be enumerated.
472+
/// </returns>
473+
/// <exception cref="ArgumentNullException"><paramref name="s"/> or <paramref name="t"/> is null.</exception>
474+
/// <exception cref="ArgumentOutOfRangeException">
475+
/// <paramref name="startIndex"/> is less than zero or greater than <see cref="IReadOnlyCollection{T}.Count">Count</see> of <paramref name="s"/>.
476+
/// </exception>
409477
public static IEnumerable<int> IndexesOf<T>(this IReadOnlyList<T> s, IReadOnlyList<T> t, int startIndex, IEqualityComparer<T> comparer)
410478
where T : IEquatable<T>
411479
{
@@ -579,7 +647,7 @@ public static IEnumerable<int> LastIndexesOf(this string s, IReadOnlyList<char>
579647
#endregion
580648

581649
#region Wrapper
582-
650+
583651
public static IReadOnlyList<T> AsReadOnlyList<T>(this IList<T> list)
584652
where T : IEquatable<T>
585653
{

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /