@@ -19,7 +19,7 @@ private float getNumMadModeledApis(string package, string provenance) {
1919 provenance in [ "generated" , "manual" , "both" ] and
2020 result =
2121 count ( SummarizedCallable sc |
22- package = sc .asCallable ( ) .getDeclaringType ( ) .getPackage ( ) .toString ( ) and
22+ package = sc .asCallable ( ) .getCompilationUnit ( ) .getPackage ( ) .getName ( ) and
2323 exists ( DataFlowTargetApi dataFlowTargApi | sc .asCallable ( ) = dataFlowTargApi ) and
2424 (
2525 sc .isAutoGenerated ( ) and // "auto-only"
@@ -39,21 +39,26 @@ bindingset[package]
3939private float getNumApis ( string package ) {
4040 result =
4141 count ( DataFlowTargetApi dataFlowTargApi |
42- package = dataFlowTargApi .getDeclaringType ( ) .getPackage ( ) .toString ( )
42+ package = dataFlowTargApi .getCompilationUnit ( ) .getPackage ( ) .getName ( )
4343 )
4444}
4545
4646from
4747 DataFlowTargetApi dataFlowTargApi , string package , float generatedOnly , float both ,
4848 float manualOnly , float non , float all , float generatedCoverage , float manualCoverage
4949where
50- package = dataFlowTargApi .getDeclaringType ( ) .getPackage ( ) .toString ( ) and
50+ // bind `package` to a `DataFlowTargetApi` package name
51+ package = dataFlowTargApi .getCompilationUnit ( ) .getPackage ( ) .getName ( ) and
52+ // count the number of APIs with generated-only, both, and manual-only MaD models for each package
5153 generatedOnly = getNumMadModeledApis ( package , "generated" ) and
52- manualOnly = getNumMadModeledApis ( package , "manual" ) and
5354 both = getNumMadModeledApis ( package , "both" ) and
55+ manualOnly = getNumMadModeledApis ( package , "manual" ) and
56+ // count the total number of `DataFlowTargetApi`s for each package
5457 all = getNumApis ( package ) and
5558 non = all - ( generatedOnly + both + manualOnly ) and
56- generatedCoverage = ( both / ( both + manualOnly ) ) and // Proportion of manual models covered by generated ones
57- manualCoverage = ( both / ( both + generatedOnly ) ) // Proportion of generated models covered by manual ones
59+ // Proportion of manual models covered by generated ones
60+ generatedCoverage = ( both / ( both + manualOnly ) ) and
61+ // Proportion of generated models covered by manual ones
62+ manualCoverage = ( both / ( both + generatedOnly ) )
5863select package , generatedOnly , both , manualOnly , non , all , generatedCoverage , manualCoverage
5964 order by package
0 commit comments