function dumpSummary(this, options)
%

%   Copyright 1990-2016 The MathWorks, Inc.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create coverage summary that is reported on the model
%                            hierarchy.

%   Copyright 1990-2016 The MathWorks, Inc.
    if options.summaryMode == 0 
        msgId = 'Slvnv:simcoverage:cvhtml:Summary';
        htmlTag = cvi.ReportScript.convertNameToHtmlTag(msgId);

        printIt(this,'<a name="%s"></a><h2>%s</h2>\n',htmlTag, getString(message(msgId)));
    end

    % Determine how the data will be formatted in the table
    
    if options.hitCntInMdlSumm
        metDispFcn = '&in_covperratios';
    else
        metDispFcn = '&in_covpercent';
    end
    if options.allTestInMdlSumm
        colIndexVar = '@1';
    else
        colIndexVar = this.totalIdx;
    end

    % Arrange the columns based on the coverage metrics
    metricCount = 0;
    txtNA = getString(message('Slvnv:simcoverage:cvhtml:NA'));
    txtCond = getString(message('Slvnv:simcoverage:cvhtml:Condition'));
    txtDec = getString(message('Slvnv:simcoverage:cvhtml:Decision'));
    
    if this.hasDecisionInfo
        metricCount = 1;
        if options.barGrInMdlSumm
            metricTitles = {{'CellFormat',['$<b>' txtDec '</b>'],2}};
            metricData = {{'If',{'&isempty','#decision'}, ...
                                 {'CellFormat',['$' txtNA],2}, ...
                           'Else', ...
                             {metDispFcn,'#decision.outTotalCnts', '#decision.justifiedOutTotalCnts','#decision.totalTotalCnts',colIndexVar}, ...
                             {'&in_bargraph','#decision.outTotalCnts', '#decision.justifiedOutTotalCnts', '#decision.totalTotalCnts', colIndexVar}, ...
                         }};
                     
        else
            metricTitles = {['$<b>' txtDec '</b>']};
            metricData = {{'If',{'&isempty','#decision'}, ...
                              ['$' txtNA], ...
                           'Else', ...
                              {metDispFcn,'#decision.outTotalCnts','#decision.justifiedOutTotalCnts','#decision.totalTotalCnts',colIndexVar}, ...
                         }};
        end
    else
        metricTitles = [];
        metricData = [];
    end

    if this.hasConditionInfo
        metricCount = metricCount+1;
        if options.barGrInMdlSumm
            metricTitles = [metricTitles {{'CellFormat',['$<b>' txtCond '</b>'],2}}];
            metricData = [metricData ...
                         {
                             {'If',{'&isempty','#condition'}, ...
                                    {'CellFormat',['$' txtNA],2}, ...
                               'Else', ...
                                    {metDispFcn,'#condition.totalHits','#condition.justifiedTotalHits','#condition.totalCnt',colIndexVar}, ...
                                    {'&in_bargraph','#condition.totalHits','#condition.justifiedTotalHits','#condition.totalCnt',colIndexVar}, ...
                             }
                         }];
        else
            metricTitles = [metricTitles {['$<b>' txtCond '</b>']}];
            metricData = [metricData ...
                         {{'If',{'&isempty','#condition'}, ...
                                ['$' txtNA], ...
                           'Else', ...
                                {metDispFcn,'#condition.totalHits','#condition.justifiedTotalHits','#condition.totalCnt',colIndexVar}, ...
                         }}];
        end
    end

    if this.hasMcdcInfo
        metricCount = metricCount+1;
        if options.barGrInMdlSumm
            metricTitles = [metricTitles {{'CellFormat','$<b>MCDC</b>',2}}];
            metricData = [metricData ...
                         {{'If',{'&isempty','#mcdc'}, ...
                                {'CellFormat',['$' txtNA],2}, ...
                           'Else', ...
                                {metDispFcn,'#mcdc.totalHits','#mcdc.justifiedTotalHits','#mcdc.totalCnt',colIndexVar}, ...
                                {'&in_bargraph','#mcdc.totalHits','#mcdc.justifiedTotalHits','#mcdc.totalCnt',colIndexVar}, ...
                         }}];
        else
            metricTitles = [metricTitles {'$<b>MCDC</b>'}];
            metricData = [metricData ...
                         {{'If',{'&isempty','#mcdc'}, ...
                                ['$' txtNA], ...
                           'Else', ...
                                {metDispFcn,'#mcdc.totalHits','#mcdc.justifiedTotalHits','#mcdc.totalCnt',colIndexVar}, ...
                         }}];
        end
    end

    if this.hasTableExecInfo
        metricCount = metricCount+1;
        if options.barGrInMdlSumm
            metricTitles = [metricTitles {{'CellFormat','$<b>TBL</b>',2}}];
            metricData = [metricData ...
                         {{'If',{'&isempty','#tableExec'}, ...
                                {'CellFormat',['$' txtNA],2}, ...
                           'Else', ...
                                {metDispFcn,'#tableExec.totalHits','#tableExec.justifiedTotalHits','#tableExec.totalCnt',colIndexVar}, ...
                                {'&in_bargraph','#tableExec.totalHits','#tableExec.justifiedTotalHits','#tableExec.totalCnt',colIndexVar}, ...
                         }}];
        else
            metricTitles = [metricTitles {'$<b>TBL</b>'}];
            metricData = [metricData ...
                         {{'If',{'&isempty','#tableExec'}, ...
                                ['$' txtNA], ...
                           'Else', ...
                                {metDispFcn,'#tableExec.totalHits','#tableExec.justifiedTotalHits','#tableExec.totalCnt',colIndexVar}, ...
                         }}];
        end
    end
    
    if this.hasTestobjectiveInfo
        for mIdx =  1:numel(this.toMetricNames)
            
            mName = this.toMetricNames{mIdx};
            metricSummAbbrev = cvi.MetricRegistry.getShortMetricTxt(mName, options);
            mFieldName = ['#' mName];
            metricCount = metricCount + 1;
            if options.barGrInMdlSumm
                
                metricTitles = [metricTitles {{'CellFormat',['$<b>' metricSummAbbrev '</b>'],2}}]; %#ok<AGROW>
                metricData = [metricData ...
                                {{'If',{'&isempty',mFieldName}, ...
                                     {'CellFormat',['$' txtNA],2}, ...
                               'Else', ...
                                 {metDispFcn,[mFieldName '.outTotalCnts'], [mFieldName '.justifiedOutTotalCnts'],[mFieldName '.totalTotalCnts'],colIndexVar}, ...
                                 {'&in_bargraph',[mFieldName '.outTotalCnts'],[mFieldName '.justifiedOutTotalCnts'], [mFieldName '.totalTotalCnts'],colIndexVar}, ...
                             }}]; %#ok<AGROW>

            else
                metricTitles = [metricTitles {['$<b>' metricSummAbbrev '</b>']}]; %#ok<AGROW>
                metricData = [metricData ... 
                                {{'If',{'&isempty',mFieldName}, ...
                                  ['$' txtNA], ...
                               'Else', ...
                                  {metDispFcn,[mFieldName '.outTotalCnts'],[mFieldName '.justifiedOutTotalCnts'],[mFieldName '.totalTotalCnts'],colIndexVar}, ...
                             }}]; %#ok<AGROW>
            end
        end
    end


    if options.barGrInMdlSumm
        colPerTest = 2*metricCount;
    else
        colPerTest = metricCount;
    end


    if options.allTestInMdlSumm
        columnData = [{'ForN',this.columnCnt} metricData {'$&#160;'}];
    else
        columnData = [{'ForN',1} metricData];
    end
    if options.isLinked 
        tocEntry = {'&in_tocentry',{'&in_href','#name','#cvId'},'@1','#depth'};
    else
        tocEntry = {'&in_tocentry','#name','@1','#depth'};
    end
    if options.complexInSumm
        ver_coulmData = {{'If',{'RpnExpr','#complexity.varDeep',0,'!'},...    
                                     {'If', '#complexity.isModule', ...
                                     {'Cat', '#complexity.varDeep'}, ...
                                   'Else', ...
                                    '#complexity.varDeep' ...
                                  },...
                          'Else',...
                           {'If', '#complexity.isModule', ...
                                {'Cat', '#complexity.deep'}, ...
                          'Else',...
                                {'If', {'RpnExpr','#complexity.deep', 0, '!'},...
                                '#complexity.deep', ...
                                'Else', {'Cat', '$&#160;' }},...
                           },...
                          },...
                          columnData,'\n'};

    
        rowEntries = {'ForEach','#system', ...
                        {'CellFormat', ...
                            tocEntry, ...
                            1, ...
                            '$"left"' ...
                        }, ...
                        ver_coulmData{:},...
                     };

        heading =  {'CellFormat', ...
                        ['$<b>' getString(message('Slvnv:simcoverage:cvhtml:ModelHierarchyComplexity')) '</b>'], ...
                        2,...
                    };
        colSpacing = {'$ ', '$ '};
    else
        ver_coulmData = { columnData,'\n'};
        
        rowEntries = {'ForEach','#system', ...
                        {'CellFormat', ...
                            tocEntry, ...
                            1, ...
                            '$"left"' ...
                        }, ...
                        ver_coulmData{:}...
                     };

        heading = ['$<b>' getString(message('Slvnv:simcoverage:cvhtml:ModelHierarchy')) '</b>'];
        colSpacing = {'$ '};
    end


    if options.allTestInMdlSumm
        if options.cumulativeReport
            sysTableTemplate = {heading, ...
                                {'CellFormat', ['$<b>' getString(message('Slvnv:simcoverage:cvhtml:CurrentRun')) '</b>'],  colPerTest}, '$&#160;', ...
                                {'CellFormat', ['$<b>' getString(message('Slvnv:simcoverage:cvhtml:Delta')) '</b>'],      colPerTest}, '$&#160;', ...
                                {'CellFormat', ['$<b>' getString(message('Slvnv:simcoverage:cvhtml:Cumulative')) '</b>'], colPerTest}, '$&#160;', ...
                                '\n', ...
                                colSpacing{:}, ...
                                {'ForN',this.columnCnt, metricTitles{:}, '$&#160;'}, ...
                                '\n', ...
                                rowEntries ...
                               };
        else
            sysTableTemplate = {heading, ...
                                {'ForN',this.testCnt, ...
                                    {'CellFormat', ...
                                        {'Cat','$<b>',{'#testLabels','@1'},'$</b>'}, ...
                                        colPerTest ...
                                    }, ...
                                    '$&#160;' ...
                                }, ...
                                {'If',{'RpnExpr',this.testCnt,1,'>'}, ...
                                    {'CellFormat', ...
                                        ['$<b>' getString(message('Slvnv:simcoverage:cvhtml:Total')) '</b>'], ...
                                        colPerTest ...
                                    } ...
                                }, ...
                                '\n', ...
                                colSpacing{:}, ...
                                {'ForN',this.columnCnt, metricTitles{:}, '$&#160;'}, ...
                                '\n', ...
                                rowEntries ...
                               };
        end %if
    else
        sysTableTemplate = {heading, ...
                            {'CellFormat', ...
                                ['$<b>' getString(message('Slvnv:simcoverage:cvhtml:Total')) '</b>'], ...
                                colPerTest ...
                            }, ...
                            '\n', ...
                            colSpacing{:}, ...
                            metricTitles{:}, ...
                            '$&#160;', ...
                            '\n', ...
                            rowEntries ...
                           };
    end


    systableInfo.cols.align = '"center"';
    systableInfo.table = 'cellpadding="2" ';
    systableInfo.textSize = 2;
    systableInfo.twoColorBarGraphs = options.twoColorBarGraphs;
    systableInfo.barGraphBorder = options.barGraphBorder;
    systableInfo.imageDir = options.imageSubDirectory;

    tableStr = cvprivate( 'html_table', this.cvstruct,sysTableTemplate,systableInfo);
    printIt(this,'%s',tableStr);
