Skip to content

Commit

Permalink
Use DEFAULT instead of INSTANCE or static field
Browse files Browse the repository at this point in the history
Matches other similar comparers.
  • Loading branch information
peppy committed Feb 21, 2024
1 parent 9298582 commit fb59347
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion osu.Game.Benchmarks/BenchmarkStringComparison.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void GlobalSetUp()
public void OrdinalIgnoreCase() => compare(StringComparer.OrdinalIgnoreCase);

[Benchmark]
public void OrdinalSortByCase() => compare(OrdinalSortByCaseStringComparer.INSTANCE);
public void OrdinalSortByCase() => compare(OrdinalSortByCaseStringComparer.DEFAULT);

[Benchmark]
public void InvariantCulture() => compare(StringComparer.InvariantCulture);
Expand Down
8 changes: 4 additions & 4 deletions osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,19 @@ public override int CompareTo(FilterCriteria criteria, CarouselItem other)
{
default:
case SortMode.Artist:
comparison = OrdinalSortByCaseStringComparer.INSTANCE.Compare(BeatmapSet.Metadata.Artist, otherSet.BeatmapSet.Metadata.Artist);
comparison = OrdinalSortByCaseStringComparer.DEFAULT.Compare(BeatmapSet.Metadata.Artist, otherSet.BeatmapSet.Metadata.Artist);
break;

case SortMode.Title:
comparison = OrdinalSortByCaseStringComparer.INSTANCE.Compare(BeatmapSet.Metadata.Title, otherSet.BeatmapSet.Metadata.Title);
comparison = OrdinalSortByCaseStringComparer.DEFAULT.Compare(BeatmapSet.Metadata.Title, otherSet.BeatmapSet.Metadata.Title);
break;

case SortMode.Author:
comparison = OrdinalSortByCaseStringComparer.INSTANCE.Compare(BeatmapSet.Metadata.Author.Username, otherSet.BeatmapSet.Metadata.Author.Username);
comparison = OrdinalSortByCaseStringComparer.DEFAULT.Compare(BeatmapSet.Metadata.Author.Username, otherSet.BeatmapSet.Metadata.Author.Username);
break;

case SortMode.Source:
comparison = OrdinalSortByCaseStringComparer.INSTANCE.Compare(BeatmapSet.Metadata.Source, otherSet.BeatmapSet.Metadata.Source);
comparison = OrdinalSortByCaseStringComparer.DEFAULT.Compare(BeatmapSet.Metadata.Source, otherSet.BeatmapSet.Metadata.Source);
break;

case SortMode.DateAdded:
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Utils/OrdinalSortByCaseStringComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace osu.Game.Utils
/// </example>
public class OrdinalSortByCaseStringComparer : IComparer<string>
{
public static readonly OrdinalSortByCaseStringComparer INSTANCE = new OrdinalSortByCaseStringComparer();
public static readonly OrdinalSortByCaseStringComparer DEFAULT = new OrdinalSortByCaseStringComparer();

private OrdinalSortByCaseStringComparer()
{
Expand Down

0 comments on commit fb59347

Please sign in to comment.