package Ġch . u zh . ifi . se al . sm r . so a . analysis . features Ċ Ċ import Ġch . u zh . ifi . se al . sm r . so a . analysis . percentage String Ċ import Ġch . u zh . ifi . se al . sm r . so a . utils . Csv Result Parser Ċ import Ġch . u zh . ifi . se al . sm r . so a . utils . Custom Mapping Strategy Ċ import Ġch . u zh . ifi . se al . sm r . so a . utils . Open CSV Writer Ċ import Ġch . u zh . ifi . se al . sm r . so a . utils . Result Ċ import Ġjava . io . File Ċ import Ġkotlin . reflect . K Mutable Property 1 Ċ Ċ private Ġval Ġoutput Ġ= Ġmutable ListOf < Res KeyValue >() Ċ Ċ fun Ġmain () Ġ{ ĊĠĠĠ Ġval Ġfile Ġ= ĠFile (" C :\\ Users \\ st ew ue \\ One Drive Ġ- ĠW uer sten \\ Uni \\ 1 9 _ HS \\ Master ar beit \\ Repo \\ Evaluation \\ RQ 1 _ Results \\ current - commit \\ merged - is Main . csv ") ĊĠĠĠ Ġval ĠoutputFile Ġ= ĠFile (" C :\\ Users \\ st ew ue \\ One Drive Ġ- ĠW uer sten \\ Uni \\ 1 9 _ HS \\ Master ar beit \\ Repo \\ Evaluation \\ RQ 1 _ Results \\ ag gregated \\ features . csv "). to Path () ĊĠĠĠ Ġval Ġall Ġ= ĠCsv Result Parser ( file ). getList () ĊĊĠĠĠ Ġval Ġno Method Argument Ġ= Ġreturn Count Map ( all , ĠResult :: param Count )[ 0 ] Ġ?: Ġ 0 ĊĠĠĠ Ġoutput . add ( Res KeyValue (" Benchmark Ġhas Ġno Ġmethod Ġargument ", Ġ"$ no Method Argument Ġ(${ percentage String ( no Method Argument , Ġall . size )}) ")) ĊĊĠĠĠ Ġhas Property ( all , Ġ" black hole ", ĠResult :: has Black hole ) ĊĠĠĠ Ġhas Property ( all , Ġ" control ", ĠResult :: has Control ) ĊĠĠĠ Ġhas Property ( all , Ġ" benchmark Params ", ĠResult :: has Benchmark Params ) ĊĠĠĠ Ġhas Property ( all , Ġ" iteration Params ", ĠResult :: has Iteration Params ) ĊĠĠĠ Ġhas Property ( all , Ġ" thread Params ", ĠResult :: has Thread Params ) ĊĠĠĠ Ġj mh Params ( all ) ĊĠĠĠ Ġhas ReturnType ( all ) ĊĠĠĠ Ġhas ReturnType Or Black Hole ( all ) ĊĊĠĠĠ Ġval Ġhas Group Ġ= Ġreturn Count Map ( all , ĠResult :: part Of Group )[ true ] Ġ?: Ġ 0 ĊĠĠĠ Ġoutput . add ( Res KeyValue (" Benchmark Ġis Ġpart Ġof Ġa Ġgroup ", Ġ"$ has Group Ġ(${ percentage String ( has Group , Ġall . size )}) ")) ĊĊĠĠĠ Ġval Ġhas No Parameter ization Ġ= Ġreturn Count Map ( all , ĠResult :: parameter ization Combin ations )[ 1 ] Ġ?: Ġ 0 ĊĠĠĠ Ġval Ġhas Parameter ization Ġ= Ġall . size Ġ- Ġhas No Parameter ization ĊĠĠĠ Ġoutput . add ( Res KeyValue (" Benchmark Ġhas Ġparameter ization ", Ġ"$ has Parameter ization Ġ(${ percentage String ( has Parameter ization , Ġall . size )}) ")) ĊĊĠĠĠ Ġparams ( all ) ĊĠĠĠ Ġavg Bench s And Inner Class Bench s ( all ) ĊĊĠĠĠ ĠOpen CSV Writer . write ( outputFile , Ġoutput , ĠCustom Mapping Strategy ( Res KeyValue :: class . java )) Ċ } Ċ Ċ private Ġfun Ġreturn Count Map ( all : ĠSet < Result >, Ġproperty : ĠK Mutable Property 1 < Result , Ġ* >): ĠMap < Any ?, ĠInt > Ġ{ ĊĠĠĠ Ġreturn Ġall . grouping By ( property ). each Count (). toList (). sorted With ( compare By Ġ{ ĊĠĠĠĠĠĠĠ Ġit . first Ġas ĠComparable < *> ĊĠĠĠ Ġ}). toMap () Ċ } Ċ Ċ private Ġfun Ġhas Property ( all : ĠSet < Result >, Ġtitle : ĠString , Ġproperty : ĠK Mutable Property 1 < Result , Ġ* >) Ġ{ ĊĠĠĠ Ġval Ġlist Ġ= Ġall . filter Ġ{ Ġproperty . get ( it ) Ġ== Ġtrue Ġ} ĊĊĠĠĠ Ġoutput . add ( Res KeyValue ( title , Ġ"${ list . size } Ġof Ġ${ all . size } Ġ(${ percentage String ( list . size , Ġall . size )}) ")) Ċ } Ċ Ċ private Ġfun Ġhas ReturnType ( all : ĠSet < Result >) Ġ{ ĊĠĠĠ Ġval Ġlist Ġ= Ġall . filter Ġ{ Ġ! it . returnType . isNull Or Blank () Ġ} ĊĊĠĠĠ Ġoutput . add ( Res KeyValue (" Benchmark Ġhas Ġreturn Ġtype ", Ġ"${ list . size } Ġof Ġ${ all . size } Ġ(${ percentage String ( list . size , Ġall . size )}) ")) Ċ } Ċ Ċ private Ġfun Ġhas ReturnType Or Black Hole ( all : ĠSet < Result >) Ġ{ ĊĠĠĠ Ġval Ġlist Ġ= Ġall . filter Ġ{ Ġ! it . returnType . isNull Or Blank () Ġ|| Ġit . has Black hole Ġ} ĊĊĠĠĠ Ġoutput . add ( Res KeyValue (" Benchmark Ġhas Ġreturn Ġtype Ġor Ġa Ġblack hole ", Ġ"${ list . size } Ġof Ġ${ all . size } Ġ(${ percentage String ( list . size , Ġall . size )}) ")) Ċ } Ċ Ċ private Ġfun Ġj mh Params ( all : ĠSet < Result >) Ġ{ ĊĠĠĠ Ġval Ġhas No J mh Params Ġ= Ġreturn Count Map ( all , ĠResult :: j mh Param Count )[ 0 ] Ġ?: Ġ 0 ĊĠĠĠ Ġoutput . add ( Res KeyValue (" Benchmark Ġhas Ġno Ġj mh Ġparams ", Ġ"$ has No J mh Params Ġ(${ percentage String ( has No J mh Params , Ġall . size )}) ")) ĊĊĠĠĠ Ġval Ġj mh Params Clean ed Ġ= Ġall . filter Ġ{ Ġit . j mh Param Count Ġ== Ġit . j mh Param Count Own Class Ġ+ Ġit . j mh Param Count Argument Ġ} ĊĠĠĠ Ġval Ġj mh Params Failed Ġ= Ġall . filter Ġ{ Ġit . j mh Param Count Ġ!= Ġit . j mh Param Count Own Class Ġ+ Ġit . j mh Param Count Argument Ġ}. size ĊĊĠĠĠ Ġval Ġj mh Params Defined In Class Ġ= Ġj mh Params Clean ed . map Ġ{ Ġit . j mh Param Count Own Class Ġ}. sum () ĊĠĠĠ Ġval Ġj mh Params Defined External Ġ= Ġj mh Params Clean ed . map Ġ{ Ġit . j mh Param Count Argument Ġ}. sum () ĊĠĠĠ Ġval Ġj mh Params Total Ġ= Ġj mh Params Defined In Class Ġ+ Ġj mh Params Defined External ĊĠĠĠ Ġoutput . add ( Res KeyValue ("$ j mh Params Total ĠJ mh Params Ġused ", Ġ"$ j mh Params Defined In Class Ġ(${ percentage String ( j mh Params Defined In Class , Ġj mh Params Total )}) Ġdefined Ġin Ġown Ġclass , Ġ$ j mh Params Defined External Ġ(${ percentage String ( j mh Params Defined External , Ġj mh Params Total )}) Ġdefined Ġexternal Ġ& Ġ$ j mh Params Failed Ġuses Ġown Ġclass Ġas Ġfunction Ġargument ")) Ċ Ċ } Ċ Ċ private Ġfun Ġparams ( all : ĠSet < Result >) Ġ{ ĊĠĠĠ Ġval ĠnumberOf State Objects With J mh Params Ġ= Ġall . map Ġ{ Ġit . param Count State Object Ġ- Ġit . param Count State Object Without J mh Param Ġ}. sum () ĊĠĠĠ Ġval ĠnumberOf State Objects Without J mh Params Ġ= Ġall . map Ġ{ Ġit . param Count State Object Without J mh Param Ġ}. sum () ĊĠĠĠ Ġval Ġtotal State Objects Ġ= Ġall . map Ġ{ Ġit . param Count State Object Ġ}. sum () ĊĠĠĠ Ġoutput . add ( Res KeyValue ("$ total State Objects Ġstate Objects Ġare Ġused ", Ġ"$ numberOf State Objects With J mh Params Ġuses Ġone Ġor Ġmore Ġj mh Params Ġand Ġ$ numberOf State Objects Without J mh Params Ġhas Ġno Ġj mh Ġparam ")) ĊĊĠĠĠ Ġval Ġhas State Object Ġ= Ġall . filter Ġ{ Ġit . param Count State Object Ġ> Ġ 0 Ġ}. size ĊĊĠĠĠ Ġoutput . add ( Res KeyValue (" state Ġobject Ġusage ", Ġ"$ has State Object Ġ(${ percentage String ( has State Object , Ġall . size )}) Ġbenchmarks Ġuse Ġa Ġstate Ġobject ")) ĊĊĠĠĠ Ġval Ġcount Black hole Ġ= Ġall . filter Ġ{ Ġit . has Black hole Ġ}. size ĊĠĠĠ Ġval Ġcount Control Ġ= Ġall . filter Ġ{ Ġit . has Control Ġ}. size ĊĠĠĠ Ġval Ġcount Benchmark Params Ġ= Ġall . filter Ġ{ Ġit . has Benchmark Params Ġ}. size ĊĠĠĠ Ġval Ġcount Iteration Params Ġ= Ġall . filter Ġ{ Ġit . has Iteration Params Ġ}. size ĊĠĠĠ Ġval Ġcount Thread Params Ġ= Ġall . filter Ġ{ Ġit . has Thread Params Ġ}. size ĊĠĠĠ Ġval Ġtotal Arguments Ġ= Ġall . map Ġ{ Ġit . param Count Ġ}. sum () ĊĠĠĠ Ġval Ġun resolved Ġ= Ġtotal Arguments Ġ- ĠnumberOf State Objects With J mh Params Ġ- ĠnumberOf State Objects Without J mh Params Ġ- Ġcount Black hole Ġ- Ġcount Control Ġ- Ġcount Benchmark Params Ġ- Ġcount Iteration Params Ġ- Ġcount Thread Params ĊĠĠĠ Ġoutput . add ( Res KeyValue ("$ total Arguments Ġmethod Ġarguments Ġare Ġused ", Ġ"$ un resolved Ġcannot Ġbe Ġresolved Ġ${ percentage String ( un resolved , Ġtotal Arguments )} ")) Ċ } Ċ Ċ private Ġfun Ġavg Bench s And Inner Class Bench s ( all : ĠSet < Result >) Ġ{ ĊĠĠĠ Ġavg NumberOf Bench marks Per Class ( all , Ġ 1 ) ĊĠĠĠ Ġavg NumberOf Bench marks Per Class ( all , Ġ 5 ) ĊĠĠĠ Ġavg NumberOf Bench marks Per Class ( all , Ġ 1 0 ) ĊĠĠĠ Ġavg NumberOf Bench marks Per Class ( all , Ġ 2 5 ) ĊĠĠĠ Ġavg NumberOf Bench marks Per Class ( all , Ġ 5 0 ) ĊĠĠĠ Ġavg NumberOf Bench marks Per Class ( all , Ġ 1 0 0 ) ĊĠĠĠ Ġavg NumberOf Bench marks Per Class ( all , Ġ 2 5 0 ) ĊĠĠĠ Ġavg NumberOf Bench marks Per Class ( all , Ġ 5 0 0 ) ĊĠĠĠ Ġavg NumberOf Bench marks Per File ( all , Ġ 1 ) ĊĠĠĠ Ġavg NumberOf Bench marks Per File ( all , Ġ 5 ) ĊĠĠĠ Ġavg NumberOf Bench marks Per File ( all , Ġ 1 0 ) ĊĠĠĠ Ġavg NumberOf Bench marks Per File ( all , Ġ 2 5 ) ĊĠĠĠ Ġavg NumberOf Bench marks Per File ( all , Ġ 5 0 ) ĊĠĠĠ Ġavg NumberOf Bench marks Per File ( all , Ġ 1 0 0 ) ĊĠĠĠ Ġavg NumberOf Bench marks Per File ( all , Ġ 2 5 0 ) ĊĠĠĠ Ġavg NumberOf Bench marks Per File ( all , Ġ 5 0 0 ) ĊĠĠĠ Ġval Ġinner Class Benchmark Ġ= Ġall . filter Ġ{ Ġit . className . contains ("$ ") Ġ}. size ĊĠĠĠ Ġoutput . add ( Res KeyValue (" benchmark Ġis Ġdefined Ġin Ġinner Ġclass ", Ġ"$ inner Class Benchmark Ġ(${ percentage String ( inner Class Benchmark , Ġall . size )}) ")) Ċ } Ċ Ċ private Ġfun Ġavg NumberOf Bench marks Per Class ( all : ĠSet < Result >, Ġmin Bench s : ĠInt ) Ġ{ ĊĠĠĠ Ġval Ġfiltered Ġ= Ġall . groupBy Ġ{ Ġit . project Ġ}. filter Ġ{ Ġit . value . size Ġ>= Ġmin Bench s Ġ}. values . flatten () ĊĠĠĠ Ġval ĠnumberOf Bench marks Ġ= Ġfiltered . size ĊĠĠĠ Ġval Ġavg NumberOf Bench marks Per Class Ġ= ĠnumberOf Bench marks Ġ/ Ġfiltered . groupBy Ġ{ Ġit . className Ġ}. count (). toDouble () ĊĠĠĠ Ġoutput . add ( Res KeyValue (" average Ġnumber Ġof Ġbenchmarks Ġper Ġclass Ġ( min =$ min Bench s )", Ġ"$ avg NumberOf Bench marks Per Class ")) Ċ } Ċ Ċ private Ġfun Ġavg NumberOf Bench marks Per File ( all : ĠSet < Result >, Ġmin Bench s : ĠInt ) Ġ{ ĊĠĠĠ Ġval Ġfiltered Ġ= Ġall . groupBy Ġ{ Ġit . project Ġ}. filter Ġ{ Ġit . value . size Ġ>= Ġmin Bench s Ġ}. values . flatten () ĊĠĠĠ Ġval ĠnumberOf Bench marks Ġ= Ġfiltered . size ĊĠĠĠ Ġval Ġavg NumberOf Bench marks Per File Ġ= ĠnumberOf Bench marks Ġ/ Ġfiltered . groupBy Ġ{ Ġit . className . substring Before ("$ ") Ġ}. count (). toDouble () ĊĠĠĠ Ġoutput . add ( Res KeyValue (" average Ġnumber Ġof Ġbenchmarks Ġper Ġfile Ġ( min =$ min Bench s )", Ġ"$ avg NumberOf Bench marks Per File ")) Ċ }