Exemplo n.º 1
0
 public static long[] LineIntersection(ProjectClassMethod method, ClonePair clone)
 {
     long[] intersection = new long[2];
     if (clone.StartLineNumber > method.EndingLine || method.StartingLine > clone.EndLineNumber)
     {
         intersection = new long[] { 0, 0 };
     }
     else
     {
         intersection[0] = Math.Max(method.StartingLine, clone.StartLineNumber);
         intersection[1] = Math.Min(method.EndingLine, clone.EndLineNumber);
     }
     return(intersection);
 }
Exemplo n.º 2
0
        public static bool LineRangesIntersect(ProjectClassMethod method, ClonePair clone)
        {
            bool exists = false;

            if (clone.StartLineNumber > method.EndingLine || method.StartingLine > clone.EndLineNumber)
            {
                exists = false;
            }
            else
            {
                exists = true;
            }
            return(exists);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Get intersection of two intervals
 /// https://scicomp.stackexchange.com/questions/26258/the-easiest-way-to-find-intersection-of-two-intervals
 /// </summary>
 /// <param name="uut"></param>
 /// <param name="clone"></param>
 /// <returns></returns>
 public static long[] LineIntersection(TestCaseUUTPair uut, ClonePair clone)
 {
     long[] intersection = new long[2];
     if (clone.StartLineNumber > uut.UutEndingLine || uut.UutStartingLine > clone.EndLineNumber)
     {
         intersection = new long[] { 0, 0 };
     }
     else
     {
         intersection[0] = Math.Max(uut.UutStartingLine, clone.StartLineNumber);
         intersection[1] = Math.Min(uut.UutEndingLine, clone.EndLineNumber);
     }
     return(intersection);
 }
Exemplo n.º 4
0
        public static bool LineRangesIntersect(TestCaseUUTPair uut, ClonePair clone, bool isTestCase)
        {
            bool exists = false;

            if (clone.StartLineNumber > (isTestCase?uut.TestEndingLine:uut.UutEndingLine) || (isTestCase ? uut.TestStartingLine : uut.UutStartingLine) > clone.EndLineNumber)
            {
                exists = false;
            }
            else
            {
                exists = true;
            }
            return(exists);
        }