private static int GetMatchedIndex(SubtitleLine s1, SubtitleLine[] list2, int j) { int k = j; double diff = double.MaxValue; int currentIndex = k; while (IsOverlap(s1, list2[k]) && k < list2.Length) { double currentDiff = OverlapSize(s1, list2[k]); if (currentDiff < diff) { return(k); } k++; } return(j); }
public static bool Matches(SubtitleLine sl1, SubtitleLine sl2) { return(sl1.StartTime <= sl2.EndTime && sl2.StartTime <= sl1.EndTime); }
private static bool IsOverlap(SubtitleLine s1, SubtitleLine s2) { return(s1.StartTime <= s2.EndTime && s1.EndTime >= s2.StartTime); }
private static double OverlapSize(SubtitleLine s1, SubtitleLine s2) { return(Math.Abs(s1.StartTime - s2.StartTime) + Math.Abs(s1.EndTime - s2.EndTime)); }