Skip to content

Commit

Permalink
should return enumerable instead for return list.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Sep 6, 2022
1 parent 5e91cd7 commit 8b36697
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Karaoke.Tests/Utils/TimeTagsUtilsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void TestSort(string[] timeTagTexts, string[] expectedTimeTags)
var timeTags = TestCaseTagHelper.ParseTimeTags(timeTagTexts);

var expected = TestCaseTagHelper.ParseTimeTags(expectedTimeTags);
var actual = TimeTagsUtils.Sort(timeTags);
var actual = TimeTagsUtils.Sort(timeTags).ToArray();
TimeTagAssert.ArePropertyEqual(expected, actual);
}

Expand Down
10 changes: 5 additions & 5 deletions osu.Game.Rulesets.Karaoke/Utils/TimeTagsUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ public static TimeTag GenerateCenterTimeTag(TimeTag startTimeTag, TimeTag endTim
/// </summary>
/// <param name="timeTags">Time tags</param>
/// <returns>Sorted time tags</returns>
public static IList<TimeTag> Sort(IEnumerable<TimeTag> timeTags)
public static IEnumerable<TimeTag> Sort(IEnumerable<TimeTag> timeTags)
{
return timeTags.OrderBy(x => x.Index)
.ThenBy(x => x.Time).ToArray();
.ThenBy(x => x.Time);
}

/// <summary>
Expand Down Expand Up @@ -177,7 +177,7 @@ IEnumerable<TimeTag> findSelfOverlapping()
}
}

return Sort(overlappingTimeTagList.Distinct());
return Sort(overlappingTimeTagList.Distinct()).ToArray();
}

/// <summary>
Expand All @@ -192,15 +192,15 @@ public static IList<TimeTag> FixOverlapping(IList<TimeTag> timeTags, GroupCheck
if (!timeTags.Any())
return timeTags;

var sortedTimeTags = Sort(timeTags);
var sortedTimeTags = Sort(timeTags).ToArray();
var groupedTimeTags = sortedTimeTags.GroupBy(x => x.Index.Index).ToArray();

var overlappingTimeTags = FindOverlapping(timeTags, other, self);
var validTimeTags = sortedTimeTags.Except(overlappingTimeTags);

foreach (var overlappingTimeTag in overlappingTimeTags)
{
int listIndex = sortedTimeTags.IndexOf(overlappingTimeTag);
int listIndex = Array.IndexOf(sortedTimeTags, overlappingTimeTag);
var timeTag = overlappingTimeTag.Index;

// fix self-overlapping
Expand Down

0 comments on commit 8b36697

Please sign in to comment.