Remove newly added equality

This commit is contained in:
Dean Herbert 2021-11-15 14:35:01 +09:00
parent a4c11e8813
commit 0b4822b552
6 changed files with 4 additions and 67 deletions

View File

@ -163,20 +163,6 @@ public bool Equals(BeatmapInfo other)
return false;
}
public bool Equals(IBeatmapInfo other)
{
if (ReferenceEquals(this, other)) return true;
if (other == null) return false;
if (other is BeatmapInfo b && Equals(b))
return true;
if (OnlineID > 0 && other.OnlineID > 0)
return other.OnlineID == OnlineID;
return false;
}
public bool AudioEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null &&
BeatmapSet.Hash == other.BeatmapSet.Hash &&
(Metadata ?? BeatmapSet.Metadata).AudioFile == (other.Metadata ?? other.BeatmapSet.Metadata).AudioFile;

View File

@ -78,20 +78,6 @@ public bool Equals(BeatmapSetInfo other)
return false;
}
public bool Equals(IBeatmapSetInfo other)
{
if (ReferenceEquals(this, other)) return true;
if (other == null) return false;
if (other is BeatmapSetInfo b && Equals(b))
return true;
if (OnlineID > 0 && other.OnlineID > 0)
return other.OnlineID == OnlineID;
return false;
}
#region Implementation of IHasOnlineID
int IHasOnlineID<int>.OnlineID => OnlineID ?? -1;

View File

@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Game.Database;
using osu.Game.Rulesets;
@ -12,7 +11,7 @@ namespace osu.Game.Beatmaps
/// <summary>
/// A single beatmap difficulty.
/// </summary>
public interface IBeatmapInfo : IHasOnlineID<int>, IEquatable<IBeatmapInfo>
public interface IBeatmapInfo : IHasOnlineID<int>
{
/// <summary>
/// The user-specified name given to this beatmap.

View File

@ -12,7 +12,7 @@ namespace osu.Game.Beatmaps
/// <summary>
/// A representation of a collection of beatmap difficulties, generally packaged as an ".osz" archive.
/// </summary>
public interface IBeatmapSetInfo : IHasOnlineID<int>, IEquatable<IBeatmapSetInfo>
public interface IBeatmapSetInfo : IHasOnlineID<int>
{
/// <summary>
/// The date when this beatmap was imported.

View File

@ -106,27 +106,6 @@ public bool Equals(RealmBeatmap? other)
return ID == other.ID;
}
#region Implementation of IEquatable<IBeatmapInfo>
public bool Equals(IBeatmapInfo? other)
{
if (ReferenceEquals(this, other)) return true;
if (other == null) return false;
if (other is RealmBeatmap b && Equals(b))
return true;
if (!string.IsNullOrEmpty(Hash) && !string.IsNullOrEmpty(other.Hash))
return Hash == other.Hash;
if (OnlineID > 0 && other.OnlineID > 0)
return other.OnlineID == OnlineID;
return false;
}
#endregion
public bool AudioEquals(RealmBeatmap? other) => other != null
&& BeatmapSet != null
&& other.BeatmapSet != null

View File

@ -7,6 +7,7 @@
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Extensions;
using Realms;
#nullable enable
@ -61,21 +62,7 @@ public bool Equals(RealmBeatmapSet? other)
return ID == other.ID;
}
public bool Equals(IBeatmapSetInfo? other)
{
if (ReferenceEquals(this, other)) return true;
if (other == null) return false;
if (other is RealmBeatmapSet b && Equals(b))
return true;
if (OnlineID > 0 && other.OnlineID > 0)
return OnlineID == other.OnlineID;
return false;
}
public override string ToString() => Metadata?.ToString() ?? base.ToString();
public override string ToString() => Metadata?.GetDisplayString() ?? base.ToString();
IEnumerable<IBeatmapInfo> IBeatmapSetInfo.Beatmaps => Beatmaps;