Rename methods to match generally how these find-methods are named elsewhere

This commit is contained in:
Dean Herbert 2021-04-28 16:57:52 +09:00
parent 48d6c9ac4b
commit f3c7694eeb
4 changed files with 10 additions and 10 deletions

View File

@ -85,7 +85,7 @@ private void assertClosestDivisors(IReadOnlyList<double> divisors, IReadOnlyList
};
for (int i = 0; i < divisors.Count; ++i)
Assert.AreEqual(closestDivisors[i], beatmap.ControlPointInfo.ClosestBeatDivisor(beatmap.HitObjects[i].StartTime), $"at index {i}");
Assert.AreEqual(closestDivisors[i], beatmap.ControlPointInfo.GetClosestBeatDivisor(beatmap.HitObjects[i].StartTime), $"at index {i}");
}
}
}

View File

@ -167,7 +167,7 @@ public void RemoveGroup(ControlPointGroup group)
/// <param name="time">The time to find the closest snapped time to.</param>
/// <param name="beatDivisor">The beat divisor to snap to.</param>
/// <param name="referenceTime">An optional reference point to use for timing point lookup.</param>
public int ClosestSnapTime(double time, int beatDivisor, double? referenceTime = null)
public int GetClosestSnappedTime(double time, int beatDivisor, double? referenceTime = null)
{
var timingPoint = TimingPointAt(referenceTime ?? time);
var beatLength = timingPoint.BeatLength / beatDivisor;
@ -182,9 +182,9 @@ public int ClosestSnapTime(double time, int beatDivisor, double? referenceTime =
/// </summary>
/// <param name="time">The time to find the closest snapped time to.</param>
/// <param name="referenceTime">An optional reference point to use for timing point lookup.</param>
public int ClosestSnapTime(double time, double? referenceTime = null)
public int GetClosestSnappedTime(double time, double? referenceTime = null)
{
return ClosestSnapTime(time, ClosestBeatDivisor(time, referenceTime), referenceTime);
return GetClosestSnappedTime(time, GetClosestBeatDivisor(time, referenceTime), referenceTime);
}
/// <summary>
@ -192,9 +192,9 @@ public int ClosestSnapTime(double time, double? referenceTime = null)
/// </summary>
/// <param name="time">The time to find the closest beat snap divisor to.</param>
/// <param name="referenceTime">An optional reference point to use for timing point lookup.</param>
public int ClosestBeatDivisor(double time, double? referenceTime = null)
public int GetClosestBeatDivisor(double time, double? referenceTime = null)
{
double getUnsnap(int divisor) => Math.Abs(time - ClosestSnapTime(time, divisor, referenceTime));
double getUnsnap(int divisor) => Math.Abs(time - GetClosestSnappedTime(time, divisor, referenceTime));
int[] divisors = BindableBeatDivisor.VALID_DIVISORS;
double smallestUnsnap = divisors.Min(getUnsnap);

View File

@ -28,7 +28,7 @@ public IEnumerable<Issue> Run(IBeatmap playableBeatmap, IWorkingBeatmap workingB
foreach (var hitobject in playableBeatmap.HitObjects)
{
double startUnsnap = hitobject.StartTime - controlPointInfo.ClosestSnapTime(hitobject.StartTime);
double startUnsnap = hitobject.StartTime - controlPointInfo.GetClosestSnappedTime(hitobject.StartTime);
string startPostfix = hitobject is IHasDuration ? "start" : "";
foreach (var issue in getUnsnapIssues(hitobject, startUnsnap, hitobject.StartTime, startPostfix))
yield return issue;
@ -39,7 +39,7 @@ public IEnumerable<Issue> Run(IBeatmap playableBeatmap, IWorkingBeatmap workingB
{
double spanDuration = hasRepeats.Duration / (hasRepeats.RepeatCount + 1);
double repeatTime = hitobject.StartTime + spanDuration * (repeatIndex + 1);
double repeatUnsnap = repeatTime - controlPointInfo.ClosestSnapTime(repeatTime);
double repeatUnsnap = repeatTime - controlPointInfo.GetClosestSnappedTime(repeatTime);
foreach (var issue in getUnsnapIssues(hitobject, repeatUnsnap, repeatTime, "repeat"))
yield return issue;
}
@ -47,7 +47,7 @@ public IEnumerable<Issue> Run(IBeatmap playableBeatmap, IWorkingBeatmap workingB
if (hitobject is IHasDuration hasDuration)
{
double endUnsnap = hasDuration.EndTime - controlPointInfo.ClosestSnapTime(hasDuration.EndTime);
double endUnsnap = hasDuration.EndTime - controlPointInfo.GetClosestSnappedTime(hasDuration.EndTime);
foreach (var issue in getUnsnapIssues(hitobject, endUnsnap, hasDuration.EndTime, "end"))
yield return issue;
}

View File

@ -301,7 +301,7 @@ private int findInsertionIndex(IReadOnlyList<HitObject> list, double startTime)
return list.Count - 1;
}
public double SnapTime(double time, double? referenceTime) => ControlPointInfo.ClosestSnapTime(time, BeatDivisor, referenceTime);
public double SnapTime(double time, double? referenceTime) => ControlPointInfo.GetClosestSnappedTime(time, BeatDivisor, referenceTime);
public double GetBeatLengthAtTime(double referenceTime) => ControlPointInfo.TimingPointAt(referenceTime).BeatLength / BeatDivisor;