function  testobjective_details(this, blkEntry, cvstruct, metricName, options, testobjectiveIdx)
%

%   Copyright 1990-2019 The MathWorks, Inc.

    if options.elimFullCovDetails &&  ...
        ( strcmp(metricName, 'cvmetric_Structural_block') || ...
          (~isempty(blkEntry.(metricName)) && all(blkEntry.(metricName).flags.fullCoverage)) )
        return;
    end

    if ~isempty(blkEntry.(metricName)) && isfield(blkEntry.(metricName),'testobjectiveIdx') && ...
	   ~isempty(blkEntry.(metricName).testobjectiveIdx)	
       if nargin < 6
            testobjectiveIdx = 1 : numel(blkEntry.(metricName).testobjectiveIdx);
       end
       testobjData = cvstruct.(metricName)(blkEntry.(metricName).testobjectiveIdx);
    else
        return;
    end
    totalCol = length(cvstruct.tests)+1;

    metricDesc = cvi.MetricRegistry.getLongMetricTxt(metricName, options);
    % not sldv testobjective, which shows only the true outcomes
    if ~testobjData(1).showOnlyTrueOutcome
        metricDesc = getString(message('Slvnv:simcoverage:cvhtml:MetricAnalyzed', metricDesc));
        decision_details_script(this, testobjData, testobjectiveIdx, totalCol, options, metricDesc);
    else
        testobjData = traceLink(this, testobjData, options);        
        %Total col is last col
        if options.cumulativeReport
            totalCol = totalCol - 1;
        end
        if totalCol==2  % We never have just 2 cols!!
            totalCol = 1;
        end     
        
        testobjEntry = { 'ForEach','#.', ...
                            {'If',{'RpnExpr',{'#hitTrueCount',totalCol},'!'} ,...
                                {'If',{'RpnExpr','#isJustified'} ,...
                                  {'&in_startcolor',options.ltBlueColor},...
                                'Else',...
                                  {'&in_startcolor',options.redColor},...
                                }...
                            }, ...
                            {'If',{'RpnExpr','#traced'} ,...
                                {'Cat','$&#160; &#160; &#160; ','#text'}, ...
                                {'Cat',{'&in_covratios','#hitTrueCount','#justifiedExecCount','#execCount'}, '#linkStr'} ...
                                'Else',...
                                {'Cat','$&#160; &#160; &#160; ','#text'}, ...
                                {'&in_covratios','#hitTrueCount','#justifiedExecCount','#execCount'},...
                            },...
                          {'&in_endcolor'}...
                          '\n'...
                   };
    
        dTableTemplate = {testobjEntry};

%         if (options.addSpace)
%             printIt(this,'\n<br/> ');
%         end

        printIt(this,['&#160; <b>' getString(message('Slvnv:simcoverage:cvhtml:MetricAnalyzed', metricDesc)) '</b><br/>\n']);
        %
        % Formatting and layout for the table of decision details
        %

        tableInfo.table = 'border="1" cellpadding="5" rules="groups"';
        tableInfo.cols = struct('align','"left"', 'width',380);
        tableInfo.cols(2) = struct('align','"center"', 'width',60);
        tableInfo.imageDir = options.imageSubDirectory;
        tableInfo.useRowGroups = 1;

        tableStr = cvprivate('html_table', testobjData, dTableTemplate,tableInfo);
        printIt(this,'%s',tableStr);
    end
end    
%=====================
function testobjData = traceLink(this, testobjData, options)
try
    for idx = 1:numel(testobjData)
        cto = testobjData(idx);

        % SLCOV_INCIDENTAL_COV_TBD - execCount might have multiple
        % elements if cvhtml called with multiple cvdata inputs.
        isIncidental = cto.hitTrueCount(1) == 0 && ~isempty(cto.executedIn);
        linkStr = this.getTraceLink(cto.executedIn, isIncidental, options);
        if ~isempty(linkStr)
            testobjData(idx).linkStr = linkStr;
            testobjData(idx).traced = 1;
        else
            testobjData(idx).traced = 0;
        end
    end
catch MEx
    rethrow(MEx);
end
end

