1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 04:13:00 +08:00

Rename method to EquivalentTo

This commit is contained in:
Dean Herbert 2018-07-05 15:00:02 +09:00
parent d11ba2df0e
commit 44aecdc3a0
7 changed files with 18 additions and 19 deletions

View File

@ -15,15 +15,14 @@ namespace osu.Game.Beatmaps.ControlPoints
public int CompareTo(ControlPoint other) => Time.CompareTo(other.Time);
/// <summary>
/// Whether this <see cref="ControlPoint"/> provides the same changes to gameplay as another <see cref="ControlPoint"/>.
/// Whether this <see cref="ControlPoint"/> provides the same parametric changes as another <see cref="ControlPoint"/>.
/// Basically an equality check without considering the <see cref="Time"/>.
/// </summary>
/// <param name="other">The <see cref="ControlPoint"/> to compare to.</param>
/// <returns>Whether this <see cref="ControlPoint"/> provides the same changes to gameplay as <paramref name="other"/>.</returns>
public virtual bool ChangeEquals(ControlPoint other) => !ReferenceEquals(null, other);
/// <returns>Whether this <see cref="ControlPoint"/> is equivalent to <paramref name="other"/>.</returns>
public virtual bool EquivalentTo(ControlPoint other) => true;
public bool Equals(ControlPoint other)
=> ChangeEquals(other)
&& !ReferenceEquals(null, other)
&& Time.Equals(other.Time);
=> EquivalentTo(other) && Time.Equals(other?.Time);
}
}

View File

@ -18,8 +18,8 @@ namespace osu.Game.Beatmaps.ControlPoints
private double speedMultiplier = 1;
public override bool ChangeEquals(ControlPoint other)
=> base.ChangeEquals(other)
public override bool EquivalentTo(ControlPoint other)
=> base.EquivalentTo(other)
&& other is DifficultyControlPoint difficulty
&& SpeedMultiplier.Equals(difficulty.SpeedMultiplier);
}

View File

@ -15,8 +15,8 @@ namespace osu.Game.Beatmaps.ControlPoints
/// </summary>
public bool OmitFirstBarLine;
public override bool ChangeEquals(ControlPoint other)
=> base.ChangeEquals(other)
public override bool EquivalentTo(ControlPoint other)
=> base.EquivalentTo(other)
&& other is EffectControlPoint effect
&& KiaiMode.Equals(effect.KiaiMode)
&& OmitFirstBarLine.Equals(effect.OmitFirstBarLine);

View File

@ -45,8 +45,8 @@ namespace osu.Game.Beatmaps.ControlPoints
return newSampleInfo;
}
public override bool ChangeEquals(ControlPoint other)
=> base.ChangeEquals(other)
public override bool EquivalentTo(ControlPoint other)
=> base.EquivalentTo(other)
&& other is SampleControlPoint sample
&& SampleBank.Equals(sample.SampleBank)
&& SampleVolume.Equals(sample.SampleVolume);

View File

@ -24,8 +24,8 @@ namespace osu.Game.Beatmaps.ControlPoints
private double beatLength = 1000;
public override bool ChangeEquals(ControlPoint other)
=> base.ChangeEquals(other)
public override bool EquivalentTo(ControlPoint other)
=> base.EquivalentTo(other)
&& other is TimingControlPoint timing
&& TimeSignature.Equals(timing.TimeSignature)
&& BeatLength.Equals(timing.BeatLength);

View File

@ -359,7 +359,7 @@ namespace osu.Game.Beatmaps.Formats
{
var existing = beatmap.ControlPointInfo.DifficultyPointAt(newPoint.Time);
if (newPoint.ChangeEquals(existing))
if (newPoint.EquivalentTo(existing))
return;
beatmap.ControlPointInfo.DifficultyPoints.RemoveAll(x => x.Time == newPoint.Time);
@ -370,7 +370,7 @@ namespace osu.Game.Beatmaps.Formats
{
var existing = beatmap.ControlPointInfo.EffectPointAt(newPoint.Time);
if (newPoint.ChangeEquals(existing))
if (newPoint.EquivalentTo(existing))
return;
beatmap.ControlPointInfo.EffectPoints.Add(newPoint);
@ -380,7 +380,7 @@ namespace osu.Game.Beatmaps.Formats
{
var existing = beatmap.ControlPointInfo.SamplePointAt(newPoint.Time);
if (newPoint.ChangeEquals(existing))
if (newPoint.EquivalentTo(existing))
return;
beatmap.ControlPointInfo.SamplePoints.Add(newPoint);

View File

@ -184,8 +184,8 @@ namespace osu.Game.Beatmaps.Formats
return baseInfo;
}
public override bool ChangeEquals(ControlPoint other)
=> base.ChangeEquals(other)
public override bool EquivalentTo(ControlPoint other)
=> base.EquivalentTo(other)
&& other is LegacySampleControlPoint legacy
&& CustomSampleBank == legacy.CustomSampleBank;
}