コード例 #1
0
        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);
        }
コード例 #2
0
 public static bool Matches(SubtitleLine sl1, SubtitleLine sl2)
 {
     return(sl1.StartTime <= sl2.EndTime && sl2.StartTime <= sl1.EndTime);
 }
コード例 #3
0
 private static bool IsOverlap(SubtitleLine s1, SubtitleLine s2)
 {
     return(s1.StartTime <= s2.EndTime && s1.EndTime >= s2.StartTime);
 }
コード例 #4
0
 private static double OverlapSize(SubtitleLine s1, SubtitleLine s2)
 {
     return(Math.Abs(s1.StartTime - s2.StartTime) + Math.Abs(s1.EndTime - s2.EndTime));
 }