function createModel(oCoverageData, iLinesOfContext, iThreshold, aTestedFiles) {
		var mSummarizedFiles = {}, // maps file name to true for already summarized files
			oTotal = {
				files : [],
				lines : {
					total : 0,
					missed : 0,
					coverage : 100
				},
				branches : {
					total : 0,
					missed : 0,
					coverage : 100
				},
				coverageData : oCoverageData,
				filterThreshold : !!iThreshold,
				branchTracking : false,
				showHits : false
			};

		function summarize(sFile) {
			var aFileData = oCoverageData.files[sFile],
				oFileSummary = {
					name : sFile,
					lines : {
						total : 0,
						missed : 0,
						coverage : 100
					},
					branches : {
						total : 0,
						missed : 0,
						coverage : 100
					}
				},
				i;

			if (sFile in mSummarizedFiles) {
				return;
			}
			mSummarizedFiles[sFile] = true;

			for (i = 0; i < aFileData.length; i++) {
				if (aFileData[i] !== undefined) {
					oFileSummary.lines.total++;
					if (aFileData[i] === 0) {
						oFileSummary.lines.missed++;
					}
				}
			}
			if (aFileData.branchTracking) {
				oTotal.branchTracking = true;
				oFileSummary.branches.total = aFileData.branchTracking.length;
				for (i = 0; i < aFileData.branchTracking.length; i++) {
					if (!aFileData.branchTracking[i].falsy
						|| !aFileData.branchTracking[i].truthy) {
						oFileSummary.branches.missed++;
					}
				}
			}
			coverage(oFileSummary);

			oTotal.files.push(oFileSummary);
			oTotal.lines.total += oFileSummary.lines.total;
			oTotal.lines.missed += oFileSummary.lines.missed;
			oTotal.branches.total += oFileSummary.branches.total;
			oTotal.branches.missed += oFileSummary.branches.missed;
		}

		if (aTestedFiles
				&& aTestedFiles.every(function (sFile) {return sFile in oCoverageData.files;})) {
			oTotal.filterThreshold = false;
		} else {
			aTestedFiles = Object.keys(oCoverageData.files);
		}
		aTestedFiles.sort().forEach(summarize);

		oTotal.linesOfContext = iLinesOfContext;
		oTotal.threshold = iThreshold;
		oTotal.visible = Math.min(Math.max(oTotal.files.length, 3), 10);

		coverage(oTotal);
		return new JSONModel(oTotal);
	}
/**
	 * Creates the JSON model from the blanket coverage data.
	 *
	 * @param {object} oCoverageData The coverage data
	 * @param {number} iLinesOfContext
	 *   Lines of context to show
	 * @param {number} iThreshold
	 *   Threshold for KPIs as a percentage
	 * @param {string[]} [aTestedFiles]
	 *   The tested files (derived from the module names) or undefined if all tests were run.
	 *   Note: unsorted, may still contain duplicates or even <code>undefined</code>!
	 * @returns {JSONModel} The JSON model
	 */
Creates the JSON model from the blanket coverage data.
@param {object} oCoverageData The coverage data
@param {number} iLinesOfContext
Lines of context to show
@param {number} iThreshold
Threshold for KPIs as a percentage
@param {string[]} [aTestedFiles]
The tested files (derived from the module names) or undefined if all tests were run.
Note: unsorted, may still contain duplicates or even undefined.
@returns {JSONModel} The JSON model
Creates the JSON model from the blanket coverage data . @param { object } oCoverageData The coverage data @param { number } iLinesOfContext Lines of context to show @param { number } iThreshold Threshold for KPIs as a percentage @param { string [] } [ aTestedFiles ] The tested files ( derived from the module names ) or undefined if all tests were run . Note : unsorted may still contain duplicates or even undefined . @returns { JSONModel } The JSON model
function createModel(oCoverageData, iLinesOfContext, iThreshold, aTestedFiles) {
		var mSummarizedFiles = {}, 
			oTotal = {
				files : [],
				lines : {
					total : 0,
					missed : 0,
					coverage : 100
				},
				branches : {
					total : 0,
					missed : 0,
					coverage : 100
				},
				coverageData : oCoverageData,
				filterThreshold : !!iThreshold,
				branchTracking : false,
				showHits : false
			};
		function summarize(sFile) {
			var aFileData = oCoverageData.files[sFile],
				oFileSummary = {
					name : sFile,
					lines : {
						total : 0,
						missed : 0,
						coverage : 100
					},
					branches : {
						total : 0,
						missed : 0,
						coverage : 100
					}
				},
				i;
			if (sFile in mSummarizedFiles) {
				return;
			}
			mSummarizedFiles[sFile] = true;
			for (i = 0; i < aFileData.length; i++) {
				if (aFileData[i] !== undefined) {
					oFileSummary.lines.total++;
					if (aFileData[i] === 0) {
						oFileSummary.lines.missed++;
					}
				}
			}
			if (aFileData.branchTracking) {
				oTotal.branchTracking = true;
				oFileSummary.branches.total = aFileData.branchTracking.length;
				for (i = 0; i < aFileData.branchTracking.length; i++) {
					if (!aFileData.branchTracking[i].falsy
						|| !aFileData.branchTracking[i].truthy) {
						oFileSummary.branches.missed++;
					}
				}
			}
			coverage(oFileSummary);
			oTotal.files.push(oFileSummary);
			oTotal.lines.total += oFileSummary.lines.total;
			oTotal.lines.missed += oFileSummary.lines.missed;
			oTotal.branches.total += oFileSummary.branches.total;
			oTotal.branches.missed += oFileSummary.branches.missed;
		}
		if (aTestedFiles
				&& aTestedFiles.every(function (sFile) {return sFile in oCoverageData.files;})) {
			oTotal.filterThreshold = false;
		} else {
			aTestedFiles = Object.keys(oCoverageData.files);
		}
		aTestedFiles.sort().forEach(summarize);
		oTotal.linesOfContext = iLinesOfContext;
		oTotal.threshold = iThreshold;
		oTotal.visible = Math.min(Math.max(oTotal.files.length, 3), 10);
		coverage(oTotal);
		return new JSONModel(oTotal);
	}
function createModel ( oCoverageData , iLinesOfContext , iThreshold , aTestedFiles ) { var mSummarizedFiles = { } , oTotal = { files : [ ] , lines : { total : 0 , missed : 0 , coverage : 100 } , branches : { total : 0 , missed : 0 , coverage : 100 } , coverageData : oCoverageData , filterThreshold : ! ! iThreshold , branchTracking : false , showHits : false } ; function summarize ( sFile ) { var aFileData = oCoverageData . files [ sFile ] , oFileSummary = { name : sFile , lines : { total : 0 , missed : 0 , coverage : 100 } , branches : { total : 0 , missed : 0 , coverage : 100 } } , i ; if ( sFile in mSummarizedFiles ) { return ; } mSummarizedFiles [ sFile ] = true ; for ( i = 0 ; i < aFileData . length ; i ++ ) { if ( aFileData [ i ] !== undefined ) { oFileSummary . lines . total ++ ; if ( aFileData [ i ] === 0 ) { oFileSummary . lines . missed ++ ; } } } if ( aFileData . branchTracking ) { oTotal . branchTracking = true ; oFileSummary . branches . total = aFileData . branchTracking . length ; for ( i = 0 ; i < aFileData . branchTracking . length ; i ++ ) { if ( ! aFileData . branchTracking [ i ] . falsy || ! aFileData . branchTracking [ i ] . truthy ) { oFileSummary . branches . missed ++ ; } } } coverage ( oFileSummary ) ; oTotal . files . push ( oFileSummary ) ; oTotal . lines . total += oFileSummary . lines . total ; oTotal . lines . missed += oFileSummary . lines . missed ; oTotal . branches . total += oFileSummary . branches . total ; oTotal . branches . missed += oFileSummary . branches . missed ; } if ( aTestedFiles && aTestedFiles . every ( function ( sFile ) { return sFile in oCoverageData . files ; } ) ) { oTotal . filterThreshold = false ; } else { aTestedFiles = Object . keys ( oCoverageData . files ) ; } aTestedFiles . sort ( ) . forEach ( summarize ) ; oTotal . linesOfContext = iLinesOfContext ; oTotal . threshold = iThreshold ; oTotal . visible = Math . min ( Math . max ( oTotal . files . length , 3 ) , 10 ) ; coverage ( oTotal ) ; return new JSONModel ( oTotal ) ; }
Creates the JSON model from the blanket coverage data.
Creates the JSON model from the blanket coverage data .
// maps file name to true for already summarized files