1function SUP = mmap_super_safe(MMAPs, maxorder, method)
2% SUP = mmap_super_safe(MMAPs, maxorder)
3% Superposition of marked MAPS
8empty = cellfun(@isempty, MMAPs);
10scv_unmarked = cellfun(@map_scv, MMAPs);
11[~,Iset]=sort(scv_unmarked); % sort flows with small scv first
13for i=Iset(:)
' % low-SCV first
14 if isempty(SUP) % is this is the first MMAP
17 % then treat it as a Poisson process if the limit is 1
18 SUP = mmap_exponential(mmap_lambda(MMAPs{i}));
21 if length(SUP{1}) * length(MMAPs{i}{1}) > maxorder
22 % otherwise treat it as a marked AMAP(2) process if the limit is >1
23 if length(SUP{1}) * 2 <= maxorder
24 SUP = mmap_super(SUP, mamap2m_fit_gamma_fb_mmap(MMAPs{i}), method);
26 SUP = mmap_super(SUP, mmap_exponential(mmap_lambda(MMAPs{i})), method);
29 SUP = mmap_super(SUP,MMAPs{i}, method);