1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 17:43:05 +08:00

Expose binary search methods publicly

Co-authored-by: Dan Balasescu <smoogipoo@smgi.me>
This commit is contained in:
Dean Herbert 2022-10-20 14:34:07 +09:00 committed by GitHub
parent a7d4a74ed6
commit a754dc6d3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -196,7 +196,7 @@ namespace osu.Game.Beatmaps.ControlPoints
/// <param name="time">The time to find the control point at.</param> /// <param name="time">The time to find the control point at.</param>
/// <param name="fallback">The control point to use when <paramref name="time"/> is before any control points.</param> /// <param name="fallback">The control point to use when <paramref name="time"/> is before any control points.</param>
/// <returns>The active control point at <paramref name="time"/>, or a fallback <see cref="ControlPoint"/> if none found.</returns> /// <returns>The active control point at <paramref name="time"/>, or a fallback <see cref="ControlPoint"/> if none found.</returns>
internal static T BinarySearchWithFallback<T>(IReadOnlyList<T> list, double time, T fallback) public static T BinarySearchWithFallback<T>(IReadOnlyList<T> list, double time, T fallback)
where T : class, IControlPoint where T : class, IControlPoint
{ {
return BinarySearch(list, time) ?? fallback; return BinarySearch(list, time) ?? fallback;
@ -208,7 +208,7 @@ namespace osu.Game.Beatmaps.ControlPoints
/// <param name="list">The list to search.</param> /// <param name="list">The list to search.</param>
/// <param name="time">The time to find the control point at.</param> /// <param name="time">The time to find the control point at.</param>
/// <returns>The active control point at <paramref name="time"/>.</returns> /// <returns>The active control point at <paramref name="time"/>.</returns>
internal static T BinarySearch<T>(IReadOnlyList<T> list, double time) public static T BinarySearch<T>(IReadOnlyList<T> list, double time)
where T : class, IControlPoint where T : class, IControlPoint
{ {
if (list == null) if (list == null)