File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -36,19 +36,26 @@ public CloneGroups(IEnumerable<(string File1, string File2)> clonePairs)
3636
3737 var duplicationFactors = CloneSets . Select ( c => c . Count ) . ToList ( ) ;
3838
39- Console . WriteLine ( $ "Avg Duplication Factor: { duplicationFactors . Average ( ) } ") ;
40- duplicationFactors . Sort ( ) ;
41- double median ;
42- int midpoint = duplicationFactors . Count / 2 ;
43- if ( duplicationFactors . Count % 2 == 0 )
39+ if ( duplicationFactors . Count > 0 )
4440 {
45- median = ( duplicationFactors [ midpoint ] + duplicationFactors [ midpoint + 1 ] ) / 2 ;
41+ Console . WriteLine ( $ "Avg Duplication Factor: { duplicationFactors . Average ( ) } ") ;
42+ duplicationFactors . Sort ( ) ;
43+ double median ;
44+ int midpoint = duplicationFactors . Count / 2 ;
45+ if ( duplicationFactors . Count % 2 == 0 )
46+ {
47+ median = ( duplicationFactors [ midpoint ] + duplicationFactors [ midpoint + 1 ] ) / 2 ;
48+ }
49+ else
50+ {
51+ median = duplicationFactors [ midpoint ] ;
52+ }
53+ Console . WriteLine ( $ "Median Duplication Factor: { median } ") ;
4654 }
4755 else
4856 {
49- median = duplicationFactors [ midpoint ] ;
57+ Console . WriteLine ( "No duplicates found." ) ;
5058 }
51- Console . WriteLine ( $ "Median Duplication Factor: { median } ") ;
5259 }
5360
5461 private int MakeCloneSetTransitive ( )
You can’t perform that action at this time.
0 commit comments