function r = times(p,q)
%CVDATA/TIMES  Implement P*Q, data intersection.
%
% When a test metric exists in only one of the arguments, the intersection
% will be empty.  Otherwise, the following rules apply:
% 
% DECISION The path counts are the minimum of the count in P and the count in 
% Q and the aggregate results are calculated from these minimums
% 
% CONDITION The condition evaluation counts are the minimum of the counts
% in P and Q and the aggregate results are calculated from these minimums.


%   Copyright 1990-2019 The MathWorks, Inc.

p = cvdata(p);
q = cvdata(q);

% Perform consistency checking
ref.type = '.';
ref.subs = 'checksum';

if ~isequal(subsref(p,ref),subsref(q,ref))
    error(message('Slvnv:simcoverage:cvdata:ChecksumNotMatch'));
end

opFcn = @(x)(min(x,[],2));
out_metrics = perform_operation(p,q,opFcn,'*', []);

r = cvdata;
r.createDerivedData(p, q, out_metrics, []);

r.sfcnCovData = SlCov.results.CodeCovDataGroup.performOp(p.sfcnCovData, q.sfcnCovData, '*');
r.codeCovData = SlCov.results.CodeCovData.performOp(p.codeCovData, q.codeCovData, '*');
